当前位置: 技术问答>linux和unix
求助:这个程序有什么错误,虽然编译通过,但是这个地址没有连接上
来源: 互联网 发布时间:2015-07-06
本文导语: #include #include #include int main() { int con,sock; struct sockaddr_in s_addr; s_addr.sin_family = AF_INET; s_addr.sin_port = htons(23); s_addr.sin_addr.s_addr = inet_addr("10.8.28.240"...
#include
#include
#include
int main()
{
int con,sock;
struct sockaddr_in s_addr;
s_addr.sin_family = AF_INET;
s_addr.sin_port = htons(23);
s_addr.sin_addr.s_addr = inet_addr("10.8.28.240");
bzero(&s_addr,sizeof(struct sockaddr));
sock = socket(AF_INET,SOCK_STREAM,0);
if(sock
#include
#include
int main()
{
int con,sock;
struct sockaddr_in s_addr;
s_addr.sin_family = AF_INET;
s_addr.sin_port = htons(23);
s_addr.sin_addr.s_addr = inet_addr("10.8.28.240");
bzero(&s_addr,sizeof(struct sockaddr));
sock = socket(AF_INET,SOCK_STREAM,0);
if(sock