Hi all, I did the change suggested by Lawson and I got further. Look: I started my test server with wine listening to port 4444: [anibal@anibal-mirror wine-20020122]$ sudo wine -- Tester.exe 4444 Could not stat /mnt/fd0 (No such file or directory), ignoring drive A: Could not stat /cdrom (No such file or directory), ignoring drive D: Going into server mode, using port: See? there's no port printed out after port: ... not sure why this is happening. Actually, there should be other lines after that as well. This is the output when the same program, Tester.exe is run in Windows 2000: Going into server mode, using port: 4444 Socket bound to port: 4444 Now waiting for connection.... And that piece is done with this code: cerr << "Going into server mode, using port: " << portNumber << endl; start_up_network(); const int fd = socket( PF_INET, SOCK_STREAM, 0 ); if ( fd == -1 ) { cerr << "Error getting socket." << endl; return; } if ( !bind_socket( fd, portNumber ) ) return; cerr << "Now waiting for connection...." << endl; so, the endl should trigger a flush. Anyway, I keep going and from another window within the same linux box (RedHat 6.2 using g++ 2.95.3 to compile wine) I telnet to the server: [anibal@anibal-mirror anibal]$ telnet anibal-mirror 4444 Trying 192.168.0.21... Connected to anibal-mirror (192.168.0.21). Escape character is '^]'. Hello there.... and bye! However, the connection is still open, the server closes the connection. If I try this in windows I get the following: Hello there.... and bye! Connection to host lost. J:\Anibal> That's what's shown on the command screen after I did a telnet (Windows telnet). Now, the server side shows the following: Going into server mode, using port: 4444 Socket bound to port: 4444 Now waiting for connection.... Got connected socket: 416 Sending message: Hello there.... and bye! ---> 25 bytes Wrote 25 bytes. ----- Client Driver Test App ----- 1. HL7 command 2. Write to socket 3. Read from socket Non-Blocking mode 5. Automated suite of tests 6. Go into server mode 9. Quit What action do you want to perform: So, as you see the server prints out more stuff, but after the Wrote 25 bytes I actually close the socket. It really doesn't seem to do the same thing in Windows as in Wine. Just more info. After I do a ctrl-c in wine I get the following: [anibal@anibal-mirror wine-20020122]$ sudo wine -- Tester.exe 4444 Could not stat /mnt/fd0 (No such file or directory), ignoring drive A: Could not stat /cdrom (No such file or directory), ignoring drive D: Going into server mode, using port: fixme:msvcrt:__CxxFrameHandler (0x40434ecc,0x40546d7c,0x40434c00,0x40434b88):stub? fixme:msvcrt:__CxxFrameHandler (0x40434b8c,0x40546d7c,0x40434818,0x404347b4):stub? fixme:msvcrt:__CxxFrameHandler (0x404347b8,0x40546d7c,0x40434444,0x404343e0):stub? fixme:msvcrt:__CxxFrameHandler (0x404343e4,0x40546d7c,0x40434070,0x4043400c):stub? fixme:msvcrt:__CxxFrameHandler (0x40434010,0x40546d7c,0x40433c9c,0x40433c38):stub? fixme:msvcrt:__CxxFrameHandler (0x40433c3c,0x40546d7c,0x404338c8,0x40433864):stub? fixme:msvcrt:__CxxFrameHandler (0x40433868,0x40546d7c,0x404334f4,0x40433490):stub? fixme:msvcrt:__CxxFrameHandler (0x40433494,0x40546d7c,0x40433120,0x404330bc):stub? fixme:msvcrt:__CxxFrameHandler (0x404330c0,0x40546d7c,0x40432d4c,0x40432ce8):stub? fixme:msvcrt:__CxxFrameHandler (0x40432cec,0x40546d7c,0x40432978,0x40432914):stub? fixme:msvcrt:__CxxFrameHandler (0x40432918,0x40546d7c,0x404325a4,0x40432540):stub? fixme:msvcrt:__CxxFrameHandler (0x40432544,0x40546d7c,0x404321d0,0x4043216c):stub? fixme:msvcrt:__CxxFrameHandler (0x40432170,0x40546d7c,0x40431dfc,0x40431d98):stub? fixme:msvcrt:__CxxFrameHandler (0x40431d9c,0x40546d7c,0x40431a28,0x404319c4):stub? fixme:msvcrt:__CxxFrameHandler (0x40434bdc,0x40546d7c,0x40434c50,0x40434b6c):stub? fixme:msvcrt:__CxxFrameHandler (0x40434b70,0x40546d7c,0x404347fc,0x40434798):stub? fixme:msvcrt:__CxxFrameHandler (0x4043479c,0x40546d7c,0x40434428,0x404343c4):stub? fixme:msvcrt:__CxxFrameHandler (0x404343c8,0x40546d7c,0x40434054,0x40433ff0):stub? fixme:msvcrt:__CxxFrameHandler (0x40433ff4,0x40546d7c,0x40433c80,0x40433c1c):stub? fixme:msvcrt:__CxxFrameHandler (0x40433c20,0x40546d7c,0x404338ac,0x40433848):stub? fixme:msvcrt:__CxxFrameHandler (0x4043384c,0x40546d7c,0x404334d8,0x40433474):stub? fixme:msvcrt:__CxxFrameHandler (0x40433478,0x40546d7c,0x40433104,0x404330a0):stub? fixme:msvcrt:__CxxFrameHandler (0x404330a4,0x40546d7c,0x40432d30,0x40432ccc):stub? fixme:msvcrt:__CxxFrameHandler (0x40432cd0,0x40546d7c,0x4043295c,0x404328f8):stub? fixme:msvcrt:__CxxFrameHandler (0x404328fc,0x40546d7c,0x40432588,0x40432524):stub? fixme:msvcrt:__CxxFrameHandler (0x40432528,0x40546d7c,0x404321b4,0x40432150):stub? fixme:msvcrt:__CxxFrameHandler (0x40432154,0x40546d7c,0x40431de0,0x40431d7c):stub? fixme:msvcrt:__CxxFrameHandler (0x40431d80,0x40546d7c,0x40431a0c,0x404319a8):stub? err:seh:EXC_DefaultHandling Exception frame is not in stack limits => unable to dispatch exception. [anibal@anibal-mirror wine-20020122]$ If you have anything for me to try I'll be more than happy. It'd be a life safer if I can use wine (and then winelib) to "port" a windows-based server that I have. Right now I'm doing the tests with this simple Tester.exe but after all the problems are ironed out with this one I'll try with the real big server and see what happens. thanks, -Anibal ----- Original Message ----- From: <lawson_whitney@juno.com> To: <wine-patches@winehq.com> Cc: <anibal@intelerad.com> Sent: Wednesday, February 13, 2002 17:25 Subject: A little defensive programming in winsock. > Good day! > > I saw this with a test winsock program Anibal Jodorcovsky sent me, which > is said to work in Windows 2000. > > If wsaddr is NULL, probably wsaddrlen is too, so it doesn't matter if > *wsaddrlen is zero. I think it makes sense to reorder the tests as I > have done. I'm attaching one in case the inline one folds. > > ChangeLog: > dlls/winsock/socket.c: > Lawson Whitney <lawson_whitney@juno.com> > Protect against NULL wsaddrlen in ws_sockaddr_alloc. > > diff -ur was/dlls/winsock/socket.c is/dlls/winsock/socket.c > --- was/dlls/winsock/socket.c Tue Jan 29 18:29:07 2002 > +++ is/dlls/winsock/socket.c Wed Feb 13 16:44:47 2002 > @@ -838,12 +838,12 @@ > /* allocates a Unix sockaddr structure to receive the data */ > inline struct sockaddr* ws_sockaddr_alloc(const struct WS_sockaddr* wsaddr, int* wsaddrlen, int* uaddrlen) > { > + if (wsaddr==NULL) > + return NULL; > if (*wsaddrlen==0) > *uaddrlen=0; > else > *uaddrlen=max(sizeof(struct sockaddr),*wsaddrlen); > - if (wsaddr==NULL) > - return NULL; > > return malloc(*uaddrlen); > } > > > > >