- 博客(0)
- 资源 (2)
空空如也
crc校验程序,客户端
crc校验小程序
WSAStartup(MAKEWORD(2,2),&wsaData);
if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
perror("socket setting error");
exit(1);
}
if((host=gethostbyname("localhost"))==NULL)
{
perror("gethostbyname error");
exit(1);
}
2011-07-02
crc校验小程序,服务端
crc小程序,服务端
if (bind(sockfd, (struct sockaddr *) &my_addr, sizeof(struct sockaddr)) == -1)
{
perror( "bind error");
exit(1);
}
if (listen(sockfd, BACKLOG) == -1)
{
perror( "listen error");
exit(1);
}
while(1) {
//sin_size = sizeof(struct sockaddr_in);
client_fd = -1;
while(client_fd== -1) {
client_fd = accept(sockfd, NULL, NULL);
}
bytesRecv = recv(client_fd, recvbuf, MAXDATASIZE, 0);
printf("RECEIVED %d bytes finished\n",bytesRecv);
break;
}
2011-07-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人