--- parser3/src/lib/smtp/comms.C 2004/02/24 10:36:16 1.3 +++ parser3/src/lib/smtp/comms.C 2012/03/16 09:24:12 1.9 @@ -1,21 +1,21 @@ /** @file Parser: SMTP sender impl. - Copyright (c) 2001-2004 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ -static const char * const IDENT_COMMS_C="$Date: 2004/02/24 10:36:16 $"; - #include "smtp.h" +volatile const char * IDENT_COMMS_C="$Id: comms.C,v 1.9 2012/03/16 09:24:12 moko Exp $"; + // --------------------------------------------------------------------------- int SMTP:: IsAddressARawIpaddress(const char* string) { while( *string ) { - if( !isdigit(*string) ) + if( !isdigit((unsigned char)*string) ) { return 0; } @@ -102,14 +102,15 @@ ResolveHostname(const char* hostname, st int SMTP:: GetAndSetTheSocket(SOCKET *the_socket) { - int _not = 0; - if( INVALID_SOCKET == (*the_socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP/*был 0, вложенно не работал*/)) ) { return WSAESOCKTNOSUPPORT; } - setsockopt(*the_socket, SOL_SOCKET, SO_DONTLINGER, (char *)&_not, sizeof(_not)); + // To enable SO_DONTLINGER (that is, disable SO_LINGER) + // l_onoff should be set to zero and setsockopt should be called + linger dont_linger={0,0}; + setsockopt(*the_socket, SOL_SOCKET, SO_LINGER, (const char *)&dont_linger, sizeof(dont_linger)); return 0; } @@ -121,7 +122,7 @@ GetConnection(SOCKET the_socket, struct if( connect(the_socket, (struct sockaddr *)sa_in, - sizeof(struct sockaddr_in)<0 ) + sizeof(struct sockaddr_in))<0 ) { int retval = 0;