diff options
| author | 2023-09-23 22:02:52 +0200 | |
|---|---|---|
| committer | 2023-09-23 22:02:52 +0200 | |
| commit | 5f5e4b587e6d21ca43a2bbdb0969ffce441cee35 (patch) | |
| tree | 0b0c1eef8241050370b147e9b45dc615c571f9e1 /xs_socket.h | |
| parent | Backport from xs. (diff) | |
| download | penes-snac2-5f5e4b587e6d21ca43a2bbdb0969ffce441cee35.tar.gz penes-snac2-5f5e4b587e6d21ca43a2bbdb0969ffce441cee35.tar.xz penes-snac2-5f5e4b587e6d21ca43a2bbdb0969ffce441cee35.zip | |
Backport from xs.
Diffstat (limited to 'xs_socket.h')
| -rw-r--r-- | xs_socket.h | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/xs_socket.h b/xs_socket.h index a2f9cb6..eea2f2d 100644 --- a/xs_socket.h +++ b/xs_socket.h | |||
| @@ -5,8 +5,7 @@ | |||
| 5 | #define _XS_SOCKET_H | 5 | #define _XS_SOCKET_H |
| 6 | 6 | ||
| 7 | int xs_socket_timeout(int s, double rto, double sto); | 7 | int xs_socket_timeout(int s, double rto, double sto); |
| 8 | int xs_socket_server_serv(const char *addr, const char *serv); | 8 | int xs_socket_server(const char *addr, const char *serv); |
| 9 | int xs_socket_server(const char *addr, int port); | ||
| 10 | FILE *xs_socket_accept(int rs); | 9 | FILE *xs_socket_accept(int rs); |
| 11 | xs_str *xs_socket_peername(int s); | 10 | xs_str *xs_socket_peername(int s); |
| 12 | int xs_socket_connect(const char *addr, const char *serv); | 11 | int xs_socket_connect(const char *addr, const char *serv); |
| @@ -44,7 +43,7 @@ int xs_socket_timeout(int s, double rto, double sto) | |||
| 44 | } | 43 | } |
| 45 | 44 | ||
| 46 | 45 | ||
| 47 | int xs_socket_server_serv(const char *addr, const char *serv) | 46 | int xs_socket_server(const char *addr, const char *serv) |
| 48 | /* opens a server socket by service name (or port as string) */ | 47 | /* opens a server socket by service name (or port as string) */ |
| 49 | { | 48 | { |
| 50 | int rs = -1; | 49 | int rs = -1; |
| @@ -88,16 +87,6 @@ end: | |||
| 88 | } | 87 | } |
| 89 | 88 | ||
| 90 | 89 | ||
| 91 | int xs_socket_server(const char *addr, int port) | ||
| 92 | /* opens a server socket (port as integer) */ | ||
| 93 | { | ||
| 94 | char serv[32]; | ||
| 95 | |||
| 96 | snprintf(serv, sizeof(serv), "%d", port); | ||
| 97 | return xs_socket_server_serv(addr, serv); | ||
| 98 | } | ||
| 99 | |||
| 100 | |||
| 101 | FILE *xs_socket_accept(int rs) | 90 | FILE *xs_socket_accept(int rs) |
| 102 | /* accepts an incoming connection */ | 91 | /* accepts an incoming connection */ |
| 103 | { | 92 | { |