Mail Archives: cygwin/1999/09/21/15:59:04
Hello !
I got accept (-1) errors when I try a program.
Here is the part where is the problem.
This program is fine on Linux, of course.
I use B20.1 Full install and the 990116 patched dll.
Is it a bug or I dont know something ?
int boltserver()
{
int k;
int s;
int g;
int fromlen;
struct sockaddr_in sin,from;
if ((k=fork())!=0)
{
if (k<0) running=0;
return k;
}
bzero((char *)&sin, sizeof(sin));
sin.sin_family=AF_INET;
sin.sin_port = htons(OTPPORT);
sin.sin_addr.s_addr = htonl(INADDR_ANY);
if ((s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) < 0)
{
fprintf(stderr,"bolt szerver socket hiba\n");
running=0;
return -1;
}
if (bind(s,(struct sockaddr*)&sin, sizeof(sin)) < 0)
{
fprintf(stderr,"bolt szerver bind hiba\n");
running=0;
return -1;
}
if (listen(s,1) < 0)
{
fprintf(stderr,"bolt szerver listen hiba\n");
running=0;
return -1;
}
while(running)
{
do {
g = accept(s,(struct sockaddr *)&from,&fromlen);
if (g==EWOULDBLOCK) sleep(1);
} while (g==EWOULDBLOCK);
if (g < 0)
{
fprintf(stderr,"bolt szerver accept hiba\n");
shutdown(g,2);
close(g);
}
else {
serveonebolt(s,g,from);
shutdown(g,2);
close(g);
}
}
return 0;
}
void serveonebolt(int s,int g,struct sockaddr_in from)
{
int pid;
int ret;
char buffer[8000];
char decod1[5000];
unsigned char block1[1500];
unsigned char block2[1500];
int k,i,n;
int il,ol,out;
int len;
R_RANDOM_STRUCT randomStruct;
pid=fork();
if (pid<0)
{
// shutdown(s,2);
// close(s);
return;
}
if (pid>0)
{
wait(&ret);
return;
}
...
Miletics Tamas
------------------------------------------------------------------------
===== EuroWeb Rt ===== Thomas Miletics - System Administrator
===== ===== H-1122 Budapest Varosmajor utca 13.
===== http://www.euroweb.hu ===== Tel.: +36 1 2244000 Fax: +36 1 2244100
------------------------------------------------------------------------
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -