ReactOS 0.4.15-dev-7681-g776c3a3
SNew.c File Reference
#include "syshdrs.h"
Include dependency graph for SNew.c:

Go to the source code of this file.

Functions

int SNewStreamClient (void)
 
int SNewDatagramClient (void)
 
int SNewStreamServer (const int port, const int nTries, const int reuseFlag, int listenQueueSize)
 
int SNewDatagramServer (const int port, const int nTries, const int reuseFlag)
 

Function Documentation

◆ SNewDatagramClient()

int SNewDatagramClient ( void  )

Definition at line 19 of file SNew.c.

20{
21 int sfd;
22
23 sfd = socket(AF_INET, SOCK_DGRAM, 0);
24 if (sfd < 0)
25 return kSNewFailed;
26
27 return (sfd);
28} /* SNewDatagramClient */
#define AF_INET
Definition: tcpip.h:117
#define kSNewFailed
Definition: sio.h:64
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
#define SOCK_DGRAM
Definition: winsock.h:336

◆ SNewDatagramServer()

int SNewDatagramServer ( const int  port,
const int  nTries,
const int  reuseFlag 
)

Definition at line 64 of file SNew.c.

65{
66 int oerrno;
67 int sfd;
68
69 sfd = socket(AF_INET, SOCK_DGRAM, 0);
70 if (sfd < 0)
71 return kSNewFailed;
72
73 if (SBind(sfd, port, nTries, reuseFlag) < 0) {
74 oerrno = errno;
75 (void) closesocket(sfd);
76 errno = oerrno;
77 return kSBindFailed;
78 }
79
80 return (sfd);
81} /* SNewDatagramServer */
int SBind(int sockfd, const int port, const int nTries, const int reuseFlag)
Definition: SBind.c:4
USHORT port
Definition: uri.c:228
#define kSBindFailed
Definition: sio.h:65
#define closesocket
Definition: ncftp.h:477
#define errno
Definition: errno.h:18

◆ SNewStreamClient()

int SNewStreamClient ( void  )

Definition at line 4 of file SNew.c.

5{
6 int sfd;
7
8 sfd = socket(AF_INET, SOCK_STREAM, 0);
9 if (sfd < 0)
10 return kSNewFailed;
11
12 return (sfd);
13} /* SNewStreamClient */
#define SOCK_STREAM
Definition: tcpip.h:118

◆ SNewStreamServer()

int SNewStreamServer ( const int  port,
const int  nTries,
const int  reuseFlag,
int  listenQueueSize 
)

Definition at line 34 of file SNew.c.

35{
36 int oerrno;
37 int sfd;
38
39 sfd = socket(AF_INET, SOCK_STREAM, 0);
40 if (sfd < 0)
41 return kSNewFailed;
42
43 if (SBind(sfd, port, nTries, reuseFlag) < 0) {
44 oerrno = errno;
45 (void) closesocket(sfd);
46 errno = oerrno;
47 return kSBindFailed;
48 }
49
50 if (SListen(sfd, listenQueueSize) < 0) {
51 oerrno = errno;
52 (void) closesocket(sfd);
53 errno = oerrno;
54 return kSListenFailed;
55 }
56
57 return (sfd);
58} /* SNewStreamServer */
int SListen(int sfd, int backlog)
Definition: SBind.c:60
#define kSListenFailed
Definition: sio.h:66

Referenced by Server().