1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 15:00:38 +00:00

Supress SIGPIPE on tcp send

This commit is contained in:
Luke Ceddia 2021-07-31 00:06:09 +10:00
parent 2afe20c5b7
commit 1e76f237de
No known key found for this signature in database
GPG key ID: 319344384A0759B0

View file

@ -21740,14 +21740,18 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void tcp_out(void *connection,void *offset,ptrszint bytes){
#if !defined(DEPENDENCY_SOCKETS)
#elif defined(QB64_WINDOWS) || defined(QB64_UNIX)
#elif defined(QB64_WINDOWS) || defined(QB64_UNIX)
// Handle Windows which might not have this flag (it would be a no-op anyway)
#if !defined(MSG_NOSIGNAL)
#define MSG_NOSIGNAL 0
#endif
tcp_connection *tcp; tcp=(tcp_connection*)connection;
int total = 0; // how many bytes we've sent
int bytesleft = bytes; // how many we have left to send
int n;
while(total < bytes) {
n = send(tcp->socket, (char*)((char *)offset + total), bytesleft, 0);
n = send(tcp->socket, (char*)((char *)offset + total), bytesleft, MSG_NOSIGNAL);
if (n < 0) {
tcp->connected = 0;
return;