Welcome![Sign In][Sign Up]
Location:
Downloads SourceCode Internet-Network
Title: socket Download
 Description: tcp udp network programming source code// create a socket sHost = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP) if (INVALID_SOCKET == sHost) (printf ( " socket failed! \ n" ) WSACleanup () // release socket Word of resources return-1 )// set the server address servAddr.sin_family = AF_INET servAddr.sin_addr.s_addr = inet_addr ( " 127.0.0.1" ) servAddr.sin_port = htons ((short) 4999) int nServAddlen = sizeof ( servAddr) // connect to the server retVal = connect (sHost, (LPSOCKADDR) & servAddr, sizeof (servAddr)) if (SOCKET_ERROR == retVal) (printf ( " connect failed! \ n" ) closesocket (sHost) // Close socket WSACleanup () // release the socket resources return-1 )// to the server sending data ZeroMemory (buf, BUF_SZIE) strcpy (buf, " MyTCP" ) retVal = send (sHost, buf, strlen (buf), 0) if (SOCKET_ERROR == retVal) (printf ( " send failed! \ n" ) closesocket (sHost) // close the socket WSACleanup () // release socket resources to return
 Downloaders recently: [More information of uploader kreasnik]
File list (Check if you may need any files):
网路编程\Client.c
........\Desk_top_.ini
........\Server.c
网路编程
    

CodeBus www.codebus.net