Article View: pl.comp.programming
Article #273connect
From: pul... Krzysztof Pulapa
Date: Tue, 06 Feb 1996 00:00
Date: Tue, 06 Feb 1996 00:00
32 lines
1344 bytes
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
Technical Details
Message-ID:
<DMD5EG.I4L@cyf-kr.edu.pl>Path:
mbox-mo1.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
From: pul...@edison.pk.edu.pl (Krzysztof Pulapa) Subject: connect Date: 1996/02/06 Message-ID: <DMD5EG.I4L@cyf-kr.edu.pl> X-Deja-AN: 138180177 sender: ne...@cyf-kr.edu.pl (News Administrator) organization: Instytut E-5 newsgroups: pl.comp.sys.pc-unix.linux,pl.comp.programming MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit