Terminate the device process gracefully
Call shutdown() on the device socket to make the device process finish its execution quickly and gracefully, without killing it.
This commit is contained in:
@@ -6,10 +6,14 @@
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
# include <winsock2.h>
|
||||
#define SHUT_RD SD_RECEIVE
|
||||
#define SHUT_WR SD_SEND
|
||||
#define SHUT_RDWR SD_BOTH
|
||||
typedef SIZE_T size_t;
|
||||
typedef SSIZE_T ssize_t;
|
||||
typedef SOCKET socket_t;
|
||||
#else
|
||||
# include <sys/socket.h>
|
||||
# define INVALID_SOCKET -1
|
||||
typedef int socket_t;
|
||||
#endif
|
||||
@@ -25,6 +29,8 @@ ssize_t net_recv(socket_t socket, void *buf, size_t len);
|
||||
ssize_t net_recv_all(socket_t socket, void *buf, size_t len);
|
||||
ssize_t net_send(socket_t socket, void *buf, size_t len);
|
||||
ssize_t net_send_all(socket_t socket, void *buf, size_t len);
|
||||
// how is SHUT_RD (read), SHUT_WR (write) or SHUT_RDWR (both)
|
||||
SDL_bool net_shutdown(socket_t socket, int how);
|
||||
void net_close(socket_t socket);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user