delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/09/21/15:59:04

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Date: Tue, 21 Sep 1999 21:56:47 +0200 (CEST)
From: Miletics Tamas <miletics AT r2 DOT euroweb DOT hu>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: my program
Message-ID: <Pine.LNX.4.10.9909212149010.25730-100000@r2.euroweb.hu>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019