blob: ce43c264a176aca3a30bf4d6b5ecd8a19a7fb998 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/* -----------------------------------------------------------------------------
* $Id: sendTo.c,v 1.3 1998/12/02 13:26:46 simonm Exp $
*
* sendTo run-time support
*
* (c) The GHC Team 1998
* -------------------------------------------------------------------------- */
#define NON_POSIX_SOURCE
#include "Rts.h"
#include "ghcSockets.h"
#include "stgio.h"
StgInt
sendTo__(StgInt fd, StgAddr buf, StgInt nbytes, StgAddr to, StgInt sz)
{
StgInt count;
int flags = 0;
while ( (count = sendto((int)fd, (void*)buf, (int)nbytes, flags, (struct sockaddr*)to, sz)) < 0) {
if (errno != EINTR) {
cvtErrno();
stdErrno();
return -1;
}
}
return count;
}
|