mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 18:21:04 +00:00
22 lines
471 B
Mathematica
22 lines
471 B
Mathematica
|
#include <stdio.h>
|
||
|
#include <objects/TcpPort.h>
|
||
|
|
||
|
int main ()
|
||
|
{
|
||
|
id port;
|
||
|
id packet;
|
||
|
|
||
|
port = [TcpInPort newForReceivingFromRegisteredName: @"tcpport-test"];
|
||
|
|
||
|
while ((packet = [port receivePacketWithTimeout: 20 * 1000]))
|
||
|
{
|
||
|
fprintf (stdout, "received >");
|
||
|
fwrite ([packet streamBuffer], [packet streamEofPosition], 1, stdout);
|
||
|
fprintf (stdout, "<\n");
|
||
|
[packet release];
|
||
|
}
|
||
|
fprintf (stdout, "Timed out. Exiting.\n");
|
||
|
|
||
|
exit (0);
|
||
|
}
|