Winsock loosing data
Winsock loosing data
Winsock loosing data
Winsock loosing data
Winsock loosing data
Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data
Winsock loosing data Winsock loosing data
Winsock loosing data
Go Back  Xtreme Visual Basic Talk > > > Winsock loosing data


Reply
 
Thread Tools Display Modes
  #1  
Old 07-22-2013, 12:24 PM
IanB53 IanB53 is offline
Newcomer
 
Join Date: Jun 2013
Posts: 3
Question Winsock loosing data


A few weeks ago I started a thread about the server closing the connection before my app had received all it's data, but got no replies.
After further monitoring what is happening is that the data is sent as a single send by the server but split into about 30 blocks by TCP. My application receives (DataArrival events) a number of blocks (about 20) when I receive a Close Connection event. If the application continues to wait the remaining blocks all arrive and the Winsock reports about 20k bytes in it's buffer. However I seem quite unable to get that data, if the application issues a Getdata the Winsock raises an error "Error in DataArrival Wrong protocol or connection state for the requested transaction or request", the state seems to be 8 "Connection Closing". But from what I've read on Getdata I should be able to issue it to get the buffered data while state is 8.
Does anyone have any ideas about this and how I can get this missing data?
Please
Reply With Quote
  #2  
Old 07-22-2013, 02:45 PM
dilettante's Avatar
dilettanteWinsock loosing data dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,520
Default

There is no reason why you can't do this using Winsock controls. The important thing is that you seem to be seeing the server close its half of the pipe after it sends data (Close event in your client).

I tested this with a small server and client where the client makes a simple request (literally a "!" character) and the server replies with 500,000 bytes of response data before closing its end. No problems at all and checksums match perfectly.


That would suggest the obvious: you have a programming bug.

Since we can't reliably guess at what and where you may be going wrong we'd need to see your code. Nobody wants to wander through somebody else's 20,000 line program, especially one they can't even test because it requires some server they won't have access to.

So if you are serious about resolving this you need to create a minimal server and client that reproduces the problem and show that to us.
Attached Files
File Type: zip Client Server Test.zip (4.0 KB, 4 views)
Reply With Quote
  #3  
Old 07-22-2013, 04:11 PM
IanB53 IanB53 is offline
Newcomer
 
Join Date: Jun 2013
Posts: 3
Default

Regarding your reply. Whether the server is closing the connection before or after it sends the data is quite irrelevant - the close event is being reported to my program (via the Close event) BEFORE all the data has arrived (via DataArrival events). I see no way to have a programming bug, it's simply two events, there is no way for me to control or affect the order that events are reported to my program. I have been programming for over 30 years, I have the experience to check 'obvious' things like that. The server is a Unix machine, 6000 miles from me, I am using Windows, I have no way to create the server. I didn't ask you to "guess" at anything, I asked if anyone had come across this before, clearly YOU haven't so why not just say that if you feel compelled to reply. I'm still hopeful that someone else may have or may have some useful ideas.
Reply With Quote
  #4  
Old 07-22-2013, 07:50 PM
PlausiblyDamp's Avatar
PlausiblyDampWinsock loosing data PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Firstly...

Given your original post didn't give any details about how many years you have been a developer or on what kind of systems or using which languages, didn't give any code at all for us to see, didn't give any indication whatsoever regarding the network infrastructure, didn't give any indication of what you may or may not have done to diagnose this problem, any specifics about how the server handles the networking side of things or even what version of VB / SP you are running we don't have much option but to guess what the hell may or may not be happening.

If you don't give us any indication of what you have tried we are going to assume you haven't tried anything - after all nobody is going to spend a lot of time researching a potentially complex issue when there may be a very simple solution that has been overlooked.

However in an attempt to offer help....

Are there other clients to this service and do they currently work ok? If so are they doing anything different at the networking level? Have you stuck a packet sniffer on the network (both ends) to see what is going on the wire and to confirm the same packets are reaching the client correctly - this could help to eliminate possible network issues.

Even though the actual server is not something you have written creating a basic server that would return the same data (even a precanned response that is a valid response would work) would allow you to see if the client can correctly handle the data from a dummy system. If not then that narrows things down, if so that eliminates more possibilities.

Do you have access to the server code (or other client code) at all to see if it is doing anything unusual in terms of network handling?

Is there any chance you could actually post your code? Seeing code helps people to help you - it is hard to analyse and comment on things we cannot see.

Apologies if you have tried some / all of these but I have no way of knowing if you have or haven't - turns out we are allowed to assume certain things about you (e.g. you have checked obvious things) but you just get grumpy if we assume the wrong things (e.g. anything else at all).
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Winsock loosing data
Winsock loosing data
Winsock loosing data Winsock loosing data
Winsock loosing data
Winsock loosing data
Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data Winsock loosing data
Winsock loosing data
Winsock loosing data
 
Winsock loosing data
Winsock loosing data
 
-->