📄 udpcmain.c
字号:
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <time.h>
#include <dos.h>
#include "tcplib.h"
//=======================================================================
int main(void)
{UDPSocket sendSock;
int port,len;
char sendBuff[1024],buf[256],ip[32];
printf("\nUDP Client\n");
port=8888;
strcpy(ip,"202.114.6.48");
sendSock=new_udpsocket();
init_tcplib();
open_udp(sendSock,ip,port);
sprintf(sendBuff, "This is a test: sending packet \n");
udp_send(sendSock,sendBuff,strlen(sendBuff));
len=udp_recv_time(sendSock,buf,256,2);
buf[len]=0;
close_udp(sendSock);
printf("Receive: %s\n",buf);
release_udpsocket(sendSock);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -