mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 08:26:27 +00:00
(main): Beginnings of changes for new port scheme.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@1469 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c4658c729b
commit
cc5d651fe8
1 changed files with 10 additions and 10 deletions
|
@ -2,23 +2,23 @@
|
|||
#include <gnustep/base/SocketPort.h>
|
||||
|
||||
#define MSG "Hello back to you, from a server SocketPort"
|
||||
#define BUFFER_SIZE 80
|
||||
|
||||
int main()
|
||||
{
|
||||
char b[BUFFER_SIZE];
|
||||
int l;
|
||||
id p = [SocketPort newLocalWithNumber:3];
|
||||
id packet;
|
||||
id p = [TcpPort newLocalWithNumber:3];
|
||||
id rp;
|
||||
int len;
|
||||
char *buf;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
l = [p receivePacket:b length:BUFFER_SIZE
|
||||
fromPort:&rp
|
||||
timeout:-1];
|
||||
if (l >= 0 && l < 32)
|
||||
b[l] = '\0';
|
||||
printf("(length %d): %s\n", l, b);
|
||||
packet = [p receivePacketWithTimeout: -1];
|
||||
len = [p streamBufferLength];
|
||||
buf = [p streamBuffer];
|
||||
if (len >= 0 && len < 32)
|
||||
buf[l] = '\0';
|
||||
printf("(length %d): %s\n", len, buf);
|
||||
|
||||
[p sendPacket:MSG length:strlen(MSG)
|
||||
toPort:rp
|
||||
|
|
Loading…
Reference in a new issue