mirror of
https://github.com/kingk85/uFTP.git
synced 2025-07-17 01:06:10 +03:00
Added condition for older OS support SO_REUSEADDR and SO_REUSEPORT
This commit is contained in:
Binary file not shown.
BIN
dist/Debug/GNU-Linux/uftp
vendored
BIN
dist/Debug/GNU-Linux/uftp
vendored
Binary file not shown.
@ -71,12 +71,16 @@ int createSocket(ftpDataType * ftpData)
|
||||
errorCode = fcntl(sock, F_SETFL, O_NONBLOCK);
|
||||
|
||||
int reuse = 1;
|
||||
|
||||
#ifdef SO_REUSEADDR
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse, sizeof(reuse)) < 0)
|
||||
perror("setsockopt(SO_REUSEADDR) failed");
|
||||
#endif
|
||||
|
||||
#ifdef SO_REUSEPORT
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (const char*)&reuse, sizeof(reuse)) < 0)
|
||||
perror("setsockopt(SO_REUSEPORT) failed");
|
||||
|
||||
#endif
|
||||
//Bind socket
|
||||
errorCode = bind(sock,(struct sockaddr*) &temp,sizeof(temp));
|
||||
|
||||
|
Reference in New Issue
Block a user