The ultimate socket library for C and C++, supporting TCP, UDP and Unix sockets (DGRAM and STREAM) on Linux, FreeBSD, Solaris. See also my uvco library for a refreshed version!
After check the connection status in below code, the sfd variable needs to be freed.
if ( -1 == check_error(connect(sfd,(struct sockaddr*)&saddr,sizeof(saddr.sun_family) + strlen(saddr.sun_path)) ) ) return -1;
After check the connection status in below code, the sfd variable needs to be freed.
if ( -1 == check_error(connect(sfd,(struct sockaddr*)&saddr,sizeof(saddr.sun_family) + strlen(saddr.sun_path)) ) ) return -1;
The code should be changed as below.
if ( -1 == check_error(connect(sfd,(struct sockaddr*)&saddr,sizeof(saddr.sun_family) + strlen(saddr.sun_path)) ) ) { close(sfd); return -1; }