利用 socket 编写 windows 和 linux 通讯程序
socket 编程大家都很熟悉,我在这里就不再罗嗦了。直接切入正题。该
程序分两部分,server 端和 client 端(谁都知道)。其中 server 端采用
windows 平台,那 linux 平台当然是 client 端了。
这里是 server 端程序:
/**********************************/
/* it worked as server under windows platform */
/* written by mlsx 1998-2-7 */
/************************************/
include <windows.h>
#include <stdio.h>
#pragma comment (lib,"WS2_32.lib")
#define USERPORT 10001
#define HOST_IP_ADDR "127.0.0.1"
main(int argc,char *argv[])
{
char buf[128];
SOCKET s,ns;
struct sockaddr_in client;