🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.programming
2 messages
2 total messages Started by pul... Krzysztof Pulapa Tue, 06 Feb 1996 00:00
connect
#273
Author: pul... Krzysztof Pulapa
Date: Tue, 06 Feb 1996 00:00
32 lines
1344 bytes
Dlaczego pod SunOS 4.1.3 ponizszy kawalek chodzi poprawnie a pod linuxem nie ?

int call_dcc(hostname,port)
char *hostname;
int port;
{
   struct sockaddr_in sa;
   int    s;
#if defined(hpux) || defined(NeXT) || defined(ultrix) || defined(POSIX)
     memset(&sa,0,sizeof(sa));
#else
     bzero(&sa,sizeof(sa));
#endif
   sa.sin_family=AF_INET;sa.sin_port=htons((u_short)port);
   sa.sin_addr.s_addr = inet_addr(hostname);
   s=socket(AF_INET, SOCK_STREAM, 0);
   if (s==-1) return(-1);
   if(connect(s,(struct sockaddr *) &sa, sizeof(sa)) < 0) 
   { 
      (void)close(s); return(-1); 
   }
   return(s);
}
                              
Udalo mie sie tylko ustalic ze -1 jest zwracane przez connect ...

PS.
    hostname to numerek , a port numer portu .
--
Pulapa Krzysztof   ,  Politechnika Krakowska
  E-mail:   pul...@edison.pk.edu.pl , ji...@avalon.wbc.lublin.pl
  URL   :   http://avalon.wbc.lublin.pl/~jimi , on IRC : Jimi
Re: connect
#274
Author: Daniel Switkowski
Date: Thu, 08 Feb 1996 00:00
22 lines
1198 bytes
On Tue, 6 Feb 1996, Krzysztof Pulapa wrote:

> Dlaczego pod SunOS 4.1.3 ponizszy kawalek chodzi poprawnie a pod linuxem nie ?
> 
>    if(connect(s,(struct sockaddr *) &sa, sizeof(sa)) < 0) 
>    { 
>       (void)close(s); return(-1); 
>    }
>                               
> Udalo mie sie tylko ustalic ze -1 jest zwracane przez connect ...
> 

Sprawdz co connect () podstawia pod errno. Przynajmniej bedziesz
wiedzial czego szukac. Poza tym przetestuj tez inet_addr ()
czy nie zwraca -1.

Powodzenia, DS

+------------------------+---------------------------------+
| Daniel Switkowski      | Warsaw University of Technology |
| d...@it.pw.edu.pl       | Faculty of Transport, Poland    |
+------------------------+---------------------------------+
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads