Thread View: demon.ip.developers
3 messages
3 total messages
Started by David Wood
Wed, 22 Nov 1995 00:00
Sockets problem - anyone come across this
Author: David Wood
Date: Wed, 22 Nov 1995 00:00
Date: Wed, 22 Nov 1995 00:00
46 lines
2932 bytes
2932 bytes
Hello one and all Firstly, appologies to those who think this may be off topic for that group, but i'm hoping someone has come across this before. Background: Server and clinet socket application runing on windows 95. Client can be telnet or finger. Using Winsock or wsock32 from M$. Using sockets dll with my own C++ wrapper i had before MFC around, so we're talking raw dll interface here. using Visual C++ but it won't make any difference here. Problem: I have a server - in this case on port 79 for finger but started as a problem in another application. Client connects to server and the server is required to send back some data then close the connection. If the closesocket or shutdown is called from with in either the FD_ACCEPT or the FD_READ it hangs the system. This can be with either a ligering shutdown or not, and is using WSAAsyncSelect. Ok. So i remove the close and put lots or debug trace statements in. I see there a quite a few meesages handled after the origonal FD_ACCEPT or FD_READ. So, at the begining of the handler, i put in an WSAAsyncSelect to select no more messages, but as the documentation points out, there can (and are) still messages in the queue to be handled. I am now in the sistuation where i can not stop the messages. I do not know when the last one has been handled, and i do not know when all the data has been sent. Has anyone seen this, got a work round. M$ contacted but first line of defence was 'well these are important calls so they have been tested'....took me two hours on the phone to get that far. Help please mucho. -- MSN, Making the world smaller and taking it to Redmond! Don't tell the FBI, but 'The Gates Cult' lives at Remond - the new WACO. __ / ) David E Wood / /_ * _ / /__/(_(|/|(_( david@thermoteknix.co.uk
Re: Sockets problem - anyone come across this
Author: Darrell Gerber
Date: Wed, 22 Nov 1995 00:00
Date: Wed, 22 Nov 1995 00:00
21 lines
1892 bytes
1892 bytes
David Wood <david@thermoteknix.co.uk> wrote: >Hello one and all [snip] >Problem: [snip] >and put lots or debug trace statements in. I see there a quite a few >meesages handled after the origonal FD_ACCEPT or FD_READ. So, at the >begining of the handler, i put in an WSAAsyncSelect to select no more >messages, but as the documentation points out, there can (and are) still >messages in the queue to be handled. I haven't run across this myself but I am reusing someone elses code right now where they have dealt with this. Basically what they do is before closing the socket they check to see if there is any data left in the queue. If there is you can either wait for it to be sent or clear it. I'm not sure exactly how they checked the queue but I'll look to see if I can find the section of code and email it to you. The reason they had to do this was for the very reason you have run into. Maybe somebody else will have a solution where you don't have to check the queue.
Re: Sockets problem - anyone come across this
Author: Ewan Kirk
Date: Thu, 23 Nov 1995 00:00
Date: Thu, 23 Nov 1995 00:00
25 lines
2028 bytes
2028 bytes
In Article <15034265wnr@thermoteknix.co.uk> David Wood writes: >Hello one and all Hi, [snip] I think you might find it's a problem in your coding. And especially in the coding of your tcp/ip class. I have a class library that does much the same thing. There's a socket class and which contains and embedded window. The window has an extra window long which stores the this pointer. When you get an fd* message you pick up the window long, cast it into a socket pointer and then call the virtual Read or Write call or something. You have to be super careful not to call the socket destructor during any of these calls because clearly that's going to screw you up because you've got to unwind back the stack through the windows procedure. It's really really easy to make mistakes with this when you have lots of derived classes and virtual function calls. For what it's worth, I call closesocket in response to fd reads or fd accepts all the time and the system doesn't hang. --E.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads