As test echo server use udpserver.c in the same directory.
To compile it do:
clang udpserver.c -o udpserver
int testTUDPSocket()
{
printf("testTSocket: Creating TUDPSocket\n");
if (!fSocket || !fSocket->
IsValid()) {
Error(
"testTSocket",
"cannot connect to localhost");
return -1;
}
TString msg =
"testTSocket: Testing TSocket with UDP";
printf(
"%s\n",msg.
Data());
Error(
"testTSocket",
"error sending command to host %s", fServer.GetHost());
return -1;
}
char msgRaw[1024] = {0};
if (recvBytes == -1){
Error(
"testTSocket",
"error receiving data from host %s", fServer.GetHost());
return -1;
}
printf("Received Message: \n%s\n",msgRaw);
return 1;
}
- Author
Definition in file testTUDPSocket.C.