
Portbase User Guide
GetData();
}
close(sock);
}
//Creates the data packet to transmit it to the server.
void SendData(void)
{
int i;
char temp[30] = "This is LoopBack Data !";
// Outputs data with the socket number 4001 of Porter.
write(sock, temp, sizeof(temp));
}
//Outputs received data on the screen.
void GetData(void)
{
int readval;
char readbuff[255];
// Reads data by the socket number 4001 of Porter.
readval = read(sock, readbuff, sizeof(readbuff));
if (readval < 1) return;
readbuff[readval] = 0;
printf("%s",readbuff);
}
116