mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-30 20:10:53 +00:00
26 lines
500 B
Mathematica
26 lines
500 B
Mathematica
|
#include <stdio.h>
|
||
|
#include <objects/TcpPort.h>
|
||
|
|
||
|
int main ()
|
||
|
{
|
||
|
id port;
|
||
|
id packet;
|
||
|
int i;
|
||
|
|
||
|
port = [TcpOutPort newForSendingToRegisteredName: @"tcpport-test"
|
||
|
onHost: @"localhost"];
|
||
|
|
||
|
for (i = 0; i < 5; i++)
|
||
|
{
|
||
|
packet = [[TcpPacket alloc] initForSendingWithCapacity: 100
|
||
|
replyPort: nil];
|
||
|
[packet writeFormat: @"Here is message number %d\n", i];
|
||
|
[port sendPacket: packet withTimeout: 20 * 1000];
|
||
|
[packet release];
|
||
|
}
|
||
|
|
||
|
[port close];
|
||
|
|
||
|
exit (0);
|
||
|
}
|