文件名称:client
-
所属分类:
- 标签属性:
- 上传时间:2016-12-12
-
文件大小:28.7mb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
Tcp_client 源代码
SOCKET sclient socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
if(sclient INVALID_SOCKET)
{
printf( invalid socket ! )
return
}
CEdit* pEdit (CEdit*)GetDlgItem(IDC_EDIT_PORT)
CString sPort
pEdit->GetWindowTextW(sPort) //获取端口字符串
int dPort _ttoi(sPort) //获取端口整形
DWORD dwIP
m_IP.GetAddress(dwIP) //获取ip
sockaddr_in serAddr
serAddr.sin_family AF_INET
serAddr.sin_port htons(dPort)
serAddr.sin_addr.S_un.S_addr htonl(dwIP)
//创建连接
if (connect(sclient, (sockaddr *)&serAddr, sizeof(serAddr)) SOCKET_ERROR)
{
closesocket(sclient)
AfxMessageBox(_T( connect error ! ))
printf( connect error ! )
return
}-Tcp_client
SOCKET sclient socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
if(sclient INVALID_SOCKET)
{
printf( invalid socket ! )
return
}
CEdit* pEdit (CEdit*)GetDlgItem(IDC_EDIT_PORT)
CString sPort
pEdit->GetWindowTextW(sPort) //获取端口字符串
int dPort _ttoi(sPort) //获取端口整形
DWORD dwIP
m_IP.GetAddress(dwIP) //获取ip
sockaddr_in serAddr
serAddr.sin_family AF_INET
serAddr.sin_port htons(dPort)
serAddr.sin_addr.S_un.S_addr htonl(dwIP)
//创建连接
if (connect(sclient, (sockaddr*)&serAddr, sizeof(serAddr)) SOCKET_ERROR)
{
closesocket(sclient)
AfxMessageBox(_T( connect error ! ))
printf( connect error ! )
return
}
SOCKET sclient socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
if(sclient INVALID_SOCKET)
{
printf( invalid socket ! )
return
}
CEdit* pEdit (CEdit*)GetDlgItem(IDC_EDIT_PORT)
CString sPort
pEdit->GetWindowTextW(sPort) //获取端口字符串
int dPort _ttoi(sPort) //获取端口整形
DWORD dwIP
m_IP.GetAddress(dwIP) //获取ip
sockaddr_in serAddr
serAddr.sin_family AF_INET
serAddr.sin_port htons(dPort)
serAddr.sin_addr.S_un.S_addr htonl(dwIP)
//创建连接
if (connect(sclient, (sockaddr *)&serAddr, sizeof(serAddr)) SOCKET_ERROR)
{
closesocket(sclient)
AfxMessageBox(_T( connect error ! ))
printf( connect error ! )
return
}-Tcp_client
SOCKET sclient socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
if(sclient INVALID_SOCKET)
{
printf( invalid socket ! )
return
}
CEdit* pEdit (CEdit*)GetDlgItem(IDC_EDIT_PORT)
CString sPort
pEdit->GetWindowTextW(sPort) //获取端口字符串
int dPort _ttoi(sPort) //获取端口整形
DWORD dwIP
m_IP.GetAddress(dwIP) //获取ip
sockaddr_in serAddr
serAddr.sin_family AF_INET
serAddr.sin_port htons(dPort)
serAddr.sin_addr.S_un.S_addr htonl(dwIP)
//创建连接
if (connect(sclient, (sockaddr*)&serAddr, sizeof(serAddr)) SOCKET_ERROR)
{
closesocket(sclient)
AfxMessageBox(_T( connect error ! ))
printf( connect error ! )
return
}
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ipch/client-cc4e64b3/client-c767fd4b.ipch
client.sdf
client.sln
client.suo
client/client.aps
client/client.cpp
client/client.h
client/client.rc
client/client.vcxproj
client/client.vcxproj.filters
client/client.vcxproj.user
client/clientDlg.cpp
client/clientDlg.h
client/Debug/client.Build.CppClean.log
client/Debug/client.log
client/ReadMe.txt
client/res/client.ico
client/res/client.rc2
client/resource.h
client/stdafx.cpp
client/stdafx.h
client/targetver.h
ipch/client-cc4e64b3
client/Debug
client/res
Debug/data
ipch
client
Debug
client.sdf
client.sln
client.suo
client/client.aps
client/client.cpp
client/client.h
client/client.rc
client/client.vcxproj
client/client.vcxproj.filters
client/client.vcxproj.user
client/clientDlg.cpp
client/clientDlg.h
client/Debug/client.Build.CppClean.log
client/Debug/client.log
client/ReadMe.txt
client/res/client.ico
client/res/client.rc2
client/resource.h
client/stdafx.cpp
client/stdafx.h
client/targetver.h
ipch/client-cc4e64b3
client/Debug
client/res
Debug/data
ipch
client
Debug
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.