Mail Archives: cygwin/2004/05/30/22:41:04
Like the subject says, I'm having trouble with select() under Cygwin, when it works under RedHat 9 and Fedora Core 2 FINAL. The output is shown below for both. And a bit of code at the bottom.
Cygwin:
JRR AT undead ~/Mud
$ make
g++ -c -g -Wall test.cpp
g++ -c -g -Wall interpreter.cpp
g++ -c -g -Wall db.cpp
g++ -c -g -Wall cmd.info.cpp
g++ -c -g -Wall cmd.comm.cpp
g++ -c -g -Wall cmd.other.cpp
g++ -c -g -Wall cmd.movement.cpp
g++ -c -g -Wall cmd.fight.cpp
g++ -c -g -Wall cmd.item.cpp
g++ -c -g -Wall cmd.calc.cpp
g++ -c -g -Wall intermud.cpp
g++ -c -g -Wall imc2.cpp
g++ -o test test.o interpreter.o db.o cmd.info.o cmd.comm.o cmd.other.o cmd.movement.o cmd.fight.o cmd.item.o cmd.calc.o intermud.
o imc2.o
JRR AT undead ~/Mud
$ ./test
Hello world!
Starting game on port 10000.
error on select wait: 9 (EBADF)
error on select polling: 9 (EBADF)
JRR AT undead ~/Mud
$ g++ --version
g++ (GCC) 3.3.1 (cygming special)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
JRR AT undead ~/Mud
$ uname -a
CYGWIN_NT-5.1 undead 1.5.10(0.116/4/2) 2004-05-25 22:07 i686 unknown unknown Cygwin
JRR AT undead ~/Mud
$
Linux RedHat 9:
[root AT localhost testMUD]# make
g++ -c -g -Wall test.cpp
g++ -c -g -Wall interpreter.cpp
g++ -c -g -Wall db.cpp
g++ -c -g -Wall cmd.info.cpp
g++ -c -g -Wall cmd.comm.cpp
g++ -c -g -Wall cmd.other.cpp
g++ -c -g -Wall cmd.movement.cpp
g++ -c -g -Wall cmd.fight.cpp
g++ -c -g -Wall cmd.item.cpp
g++ -c -g -Wall cmd.calc.cpp
g++ -c -g -Wall intermud.cpp
g++ -c -g -Wall imc2.cpp
g++ -o test test.o interpreter.o db.o cmd.info.o cmd.comm.o cmd.other.o cmd.movement.o cmd.fight.o cmd.item.o cmd.calc.o intermud.
o imc2.o
[root AT localhost testMUD]# ./test
Hello world!
Starting game on port 10000.
Connection request from [192.168.1.102]
Loaded character [Serai]
[Serai][192.168.1.102] has joined the game.
Serai: 'who'
Serai: '/s'
Intermud -->|<-- Normal Termination
Clean shutdown.
Removing player: [Serai][192.168.1.102]
[root AT localhost testMUD]# g++ --version
g++ (GCC) 3.3.2
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root AT localhost testMUD]# uname -a
Linux localhost.localdomain 2.4.20-31.9 #1 Tue Apr 13 17:41:45 EDT 2004 i686 i686 i386 GNU/Linux
[root AT localhost testMUD]#
Some of the code:
void mainLoop(int s)
{
char buff[1024];
int maxfd;
fd_set readSet, writeSet, exceptSet;
struct timeval nullTime, sleepTime;
maxfd = 300;
nullTime.tv_sec = 0;
nullTime.tv_usec = 0;
sleepTime.tv_sec = 0;
sleepTime.tv_usec = SLEEP_TIME; /* 1000000 usec = 1 sec */
while (!finished)
{
if (!firstInfo)
{
FD_ZERO(&readSet);
FD_SET((unsigned int)s, &readSet);
if (select(maxfd + 1, &readSet, (fd_set *)0, (fd_set *)0, NULL) < 0)
{
fprintf(stderr, "error on select wait: %i\n", __ERRNO__);
}
}
FD_ZERO(&readSet);
FD_ZERO(&writeSet);
FD_ZERO(&exceptSet);
FD_SET((unsigned int)s, &readSet);
if (select(maxfd + 1, &readSet, &writeSet, &exceptSet, &nullTime) < 0)
{
fprintf(stderr, "error on select polling: %i\n", __ERRNO__);
exit(0);
}
Sorry if it's a bit long, and thanks in advance for any help that can be provided.
Joshua
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -