Re: [Flightgear-devel] simgear SGSocket returning -1
Bernie Bright writes: SGSocket::readline() and SGSocket::read() do act differently. For a server, readline() correctly handles the accept and reads from the new socket. read() also handles the accept but reads from the master socket. I'm not sure if this is intentional or if its a bug. Someone else wrote in reporting a problem here. THey also said that reading from the new socket fixed the problem in read(). If it seems to make sense, maybe we should make read() read from the new socket? Regards, Curt. -- Curtis Olson HumanFIRST Program FlightGear Project Twin Citiescurt 'at' me.umn.edu curt 'at' flightgear.org Minnesota http://www.flightgear.org/~curt http://www.flightgear.org ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] simgear SGSocket returning -1
Curtis L. Olson writes: Bernie Bright writes: SGSocket::readline() and SGSocket::read() do act differently. For a server, readline() correctly handles the accept and reads from the new socket. read() also handles the accept but reads from the master socket. I'm not sure if this is intentional or if its a bug. Someone else wrote in reporting a problem here. THey also said that reading from the new socket fixed the problem in read(). If it seems to make sense, maybe we should make read() read from the new socket? It looks like readline() uses sock.recv() for UDP style sockets and client-recv() for tcp style sockets. I will make read() work the same way and hope I don't break anything. Judging from style and lack of familiarity, I don't think it was me who wrote the code. Regards, Curt. -- Curtis Olson HumanFIRST Program FlightGear Project Twin Citiescurt 'at' me.umn.edu curt 'at' flightgear.org Minnesota http://www.flightgear.org/~curt http://www.flightgear.org ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] simgear SGSocket returning -1
On Thu, 27 Nov 2003 07:23:30 -0600 Curtis L. Olson [EMAIL PROTECTED] wrote: Curtis L. Olson writes: Bernie Bright writes: SGSocket::readline() and SGSocket::read() do act differently. For a server, readline() correctly handles the accept and reads from the new socket. read() also handles the accept but reads from the master socket. I'm not sure if this is intentional or if its a bug. Someone else wrote in reporting a problem here. THey also said that reading from the new socket fixed the problem in read(). If it seems to make sense, maybe we should make read() read from the new socket? It looks like readline() uses sock.recv() for UDP style sockets and client-recv() for tcp style sockets. I will make read() work the same way and hope I don't break anything. Judging from style and lack of familiarity, I don't think it was me who wrote the code. I think I'm responsible for the current code. I remember rewriting it using plib.net a couple of years ago. I agree that read() should work the same as readline() but I don't remember why it wasn't so in the first place. Bernie ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] simgear SGSocket returning -1
I have done some extensive testing with read() using tcp and it seems to be working great. Thanks, Seamus On Fri, 28 Nov 2003, Bernie Bright wrote: On Thu, 27 Nov 2003 07:23:30 -0600 Curtis L. Olson [EMAIL PROTECTED] wrote: Curtis L. Olson writes: Bernie Bright writes: SGSocket::readline() and SGSocket::read() do act differently. For a server, readline() correctly handles the accept and reads from the new socket. read() also handles the accept but reads from the master socket. I'm not sure if this is intentional or if its a bug. Someone else wrote in reporting a problem here. THey also said that reading from the new socket fixed the problem in read(). If it seems to make sense, maybe we should make read() read from the new socket? It looks like readline() uses sock.recv() for UDP style sockets and client-recv() for tcp style sockets. I will make read() work the same way and hope I don't break anything. Judging from style and lack of familiarity, I don't think it was me who wrote the code. I think I'm responsible for the current code. I remember rewriting it using plib.net a couple of years ago. I agree that read() should work the same as readline() but I don't remember why it wasn't so in the first place. Bernie ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] simgear SGSocket returning -1
On Wed, 26 Nov 2003 16:59:53 -0700 Seamus Thomas Carroll [EMAIL PROTECTED] wrote: Hi, I am trying to recieve a message using SGSocket::read. SGSocket::read returns zero bytes read until about the time I am expecting the first message to be recieved. From here on SGSocket::read returns that -1 bytes have been read from the socket. I have looked around (simgear docs, plib) and I cant find out what the -1 is supposed to indicate. Does anyone know? On unix -1 indicates an error. The actual error code is in the external variable errno. Call strerror(errno) to convert errno to a string. Bernie ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] simgear SGSocket returning -1
I output the error and I am getting: Transport endpoint is not connected The strange part is if I put '\n' at the end of the message and read with 'readline' the message is successfully recieved. Is this a problem with 'read'? Seamus On Thu, 27 Nov 2003, Bernie Bright wrote: On Wed, 26 Nov 2003 16:59:53 -0700 Seamus Thomas Carroll [EMAIL PROTECTED] wrote: Hi, I am trying to recieve a message using SGSocket::read. SGSocket::read returns zero bytes read until about the time I am expecting the first message to be recieved. From here on SGSocket::read returns that -1 bytes have been read from the socket. I have looked around (simgear docs, plib) and I cant find out what the -1 is supposed to indicate. Does anyone know? On unix -1 indicates an error. The actual error code is in the external variable errno. Call strerror(errno) to convert errno to a string. Bernie ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] simgear SGSocket returning -1
On Wed, 26 Nov 2003 18:04:50 -0700 Seamus Thomas Carroll [EMAIL PROTECTED] wrote: I output the error and I am getting: Transport endpoint is not connected From man recv ENOTCONN The socket is associated with a connection-oriented protocol and has not been connected (see connect(2) and accept(2)). If its the server side that is failing then accept() wasn't called or you are trying to read from the master socket. But see below... The strange part is if I put '\n' at the end of the message and read with 'readline' the message is successfully recieved. Is this a problem with 'read'? SGSocket::readline() and SGSocket::read() do act differently. For a server, readline() correctly handles the accept and reads from the new socket. read() also handles the accept but reads from the master socket. I'm not sure if this is intentional or if its a bug. Bernie ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel