ReactOS 0.4.15-dev-7677-g8209aa5
SSendto.c File Reference
#include "syshdrs.h"
Include dependency graph for SSendto.c:

Go to the source code of this file.

Functions

int SSendto (int sfd, const char *const buf, size_t size, int fl, const struct sockaddr_in *const toAddr, int tlen)
 
int Sendto (int sfd, const char *const buf, size_t size, const struct sockaddr_in *const toAddr)
 

Function Documentation

◆ Sendto()

int Sendto ( int  sfd,
const char *const  buf,
size_t  size,
const struct sockaddr_in *const  toAddr 
)

Definition at line 127 of file SSendto.c.

128{
129 int result;
130
131 do {
132 result = sendto(sfd, buf, size, 0,
133 (struct sockaddr *) toAddr,
134 (int) sizeof(struct sockaddr_in));
135 } while ((result < 0) && (errno == EINTR));
136 return (result);
137} /* Sendto */
#define EINTR
Definition: acclib.h:80
INT WSAAPI sendto(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
Definition: send.c:82
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint64EXT * result
Definition: glext.h:11304
#define errno
Definition: errno.h:18

◆ SSendto()

int SSendto ( int  sfd,
const char *const  buf,
size_t  size,
int  fl,
const struct sockaddr_in *const  toAddr,
int  tlen 
)

Definition at line 68 of file SSendto.c.

69{
70 int nwrote, tleft;
71 time_t done, now;
72 fd_set ss;
73 struct timeval tv;
74 int result;
75
76 time(&now);
77 done = now + tlen;
78 nwrote = 0;
79 forever {
80 forever {
81 if (now >= done) {
84 return (kTimeoutErr);
85 }
86 tleft = (int) (done - now);
87 errno = 0;
88 FD_ZERO(&ss);
89 FD_SET(sfd, &ss);
90 tv.tv_sec = tleft;
91 tv.tv_usec = 0;
93 if (result == 1) {
94 /* ready */
95 break;
96 } else if (result == 0) {
97 /* timeout */
100 return (kTimeoutErr);
101 } else if (errno != EINTR) {
102 return (-1);
103 }
104 time(&now);
105 }
106
107 nwrote = sendto(sfd, buf, size, fl,
108 (struct sockaddr *) toAddr,
109 (int) sizeof(struct sockaddr_in));
110
111 if (nwrote >= 0)
112 break;
113 if (errno != EINTR)
114 break; /* Fatal error. */
115 }
116
117 return (nwrote);
118} /* SSendto */
#define NULL
Definition: types.h:112
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
Definition: select.c:41
#define ETIMEDOUT
Definition: errno.h:121
__kernel_time_t time_t
Definition: linux.h:252
time_t now
Definition: finger.c:65
#define ss
Definition: i386-dis.c:441
#define SELECT_TYPE_ARG234
Definition: wincfg.h:4
#define SELECT_TYPE_ARG5
Definition: wincfg.h:7
__u16 time
Definition: mkdosfs.c:8
#define SETWSATIMEOUTERR
Definition: sio.h:120
#define kTimeoutErr
Definition: sio.h:58
#define forever
Definition: ncftp.h:73
Definition: winsock.h:66
_In_ FLONG fl
Definition: winddi.h:1279
#define FD_ZERO(set)
Definition: winsock.h:96
#define FD_SET(fd, set)
Definition: winsock.h:89