文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>the udp communication between PHP and C

the udp communication between PHP and C

时间:2007-10-25  来源:heavenflying

#include
#include
#include
#include
#include
#include
#include
#include
#include
void main(){
    int sock;
    struct sockaddr_in server,client;
    int recvd,snd;
    int structlength;
    char * server_ip = "128.168.10.1";/*server ip address*/
    int port = 8888;
    char recvbuf[2000],sendbuf[2000];   
    char str1[]="I have received:\n";
    memset((char *)&server,0,sizeof(server));
    server.sin_family = AF_INET;
    server.sin_addr.s_addr = inet_addr(server_ip);
    server.sin_port = htons(port);
    memset((char *)&client,0,sizeof(client));
    client.sin_family = AF_INET;
    client.sin_addr.s_addr = htonl(INADDR_ANY);
    client.sin_port = htons(port);
    if((sock = socket (AF_INET,SOCK_DGRAM,0))
structlength = sizeof(server);
    if( bind(sock,(struct sockaddr *) &server,structlength)
}   
close(sock);
}
/*
gcc -o server server.c
./server
*/
/*client.php*/

Refer from www.zaoxue.com


相关阅读 更多 +
排行榜 更多 +
hacked

hacked

休闲益智 下载
佩科佩科的寿司手机版

佩科佩科的寿司手机版

休闲益智 下载
钓鱼好友

钓鱼好友

休闲益智 下载