Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I emulate a winsock control using APIs?

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
0
0
AU
Can anyone point me to how to build the equivalent of a winsock using API's

In particular I want to write a quick dataarrival sub that received all the data in one chunk. The current Winsock control has a limit of 8000 bytes pre read and it is very slow receiving pic files about 2meg big because you have to accumulate all the chunks in a stream before you can show the pic.
 
Ted,

I thought we'd pretty much covered this in depth in thread222-1335999 (and related threads). I really don't think you'll see much, if any, of a speed increase by going to the API for this. But good luck ...
 
Thanks but the solutions that were proposed are not optimal and not representative of the speed that a network is capable of. The method of using double winsocks is not good because in the project I am working on there are 24 computers involved all talking to the server and exchanging data effectively 'simultaneously'. It is in effect a visual monitoring application with 24 web cameras at 24 clients showing frame captures on one server with the ability for one person to click on one of the 24 thumbnails and show one pic larger to examine the detail. One application would be for the supervisor of a library to see if a customer was sitting in front of a computer or not.
The method of opening and closing sockets every time you want to send something is much slower and uses accumulated chunks in a stream anyway.
Using the SOX method ( that uses API routines) as I mentioned is definitely faster however it temporarily hangs the client computer if you try to connect to a firewalled computer and sometimes doesnt receive data from a Winsock socket even though it connects OK.
Surely the sending of large files quickly must be commonplace so what does everyone else do?
 
>Surely the sending of large files quickly must be commonplace so what does everyone else do?

Both dilettante and myself achived dramatically fatsrer speeds than you did in the referenced thread. Might I suggest that you reinvestigate ...
 
Im away again for a few more weeks thnks
 
No, Ive just returned from Peru, having had a great holiday.\
I am now experimenting with Winsock API calls. The SOX thingy gives the source code of the OCX and you can see how it works from that. I am trying to isolate only the routines I actually need and call them directly from my app because SOX has far more other features that I need.
I noted a reference to the inability of vb6 to properly handle complex network stuff and am considering moving to VB Net for this aspect of things, although I have heard this has problems too.
Maybe a DLL could be written in VBnet and used in the general VB6 framework but I don't know how effective this would be.
I really want to get away from receiving a pic in chunks.
Ted
 
>I really want to get away from receiving a pic in chunks

Well, good luck. I'm not sure how you're going to avoid the fact that TCP/IP works in chunks (segments, packets, etc,), but I'd be interested to hear how you get on.
 
What I meant was, if the "winsock" to accumulates the data in one go in chunks of the size that TCPIP uses, the accumulation can be done much faster than adding it externally in the vb code in 8k chunks. IE I need a data arrival sub with an expandable buffersize to fit the incoming picture.
Your method that used 2 winsocks still receives the data in 8k chunks by the fact that the dataarrival sub fires multiple times because the buffer has not been emptied.

This is what the SOX winsock does and is considerably faster than MSWinsock with receiving large files. However it is not suitable for my use for another reason.
One of the computers is a server connected to 20 client computers all sending 1mb pictures randomly, at a rate of one from 2 to 20 seconds apart. This computer is also a single client to another remote server to obtain data regularly and feed reports.
Unfortunately I cant get SOX to manage having a server and client on the one computer connected to other computers and I am afraid of releasing an app using an unsupported OCX that I dont have confidence in (or fully understand!).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top