PDA

View Full Version : WinSock control


Dasher
2002-10-18, 08:45 AM
Does anyone have a good routine to check for errors in Visual Basic 6.0 connection using the UDP protocol. I want the machines using the connections to receive acknowlegment that the receiving computer has received the original message, and that the sending computer has received the confirmation that the receiving computer has acknowledged its reception.

drivehappy
2002-10-18, 10:25 PM
I havent used UDP protocol much, but heres what I usually do:

I believe with UDP protocol, you must bind the winsocks to each other--but anyways after you have sent the first data from w1 to w2, tell the w2 on data arrival, w2.senddata strTest-- then on the w1 data arrival, w1.getdata strTest2. Just put a msgbox or something to display the string test2. If this is confusing, Ill make it clearer, or just pm me.

Dasher
2002-10-21, 01:53 PM
Thanks will try that with my new version. Still working on it trying to use as many objects as i can

Dasher
2002-10-21, 01:57 PM
Dang sorry got cut off there. I have been trying to use objects for the message and users. I will try your solution when I get back to it. Working on some notes scripting right now. Thanks again though.

drivehappy
2002-10-28, 06:42 PM
Well that sentence about using as many objects as you can... we're you reffering to winsock controls? If so make an array of the host and client, then delete the ones you had to copy to make the array (so you're only left with the host and client wns. control). Then make a command button, put in a "Load wnsHost(wnsHost.Count + 1)" statement same with the client. Make sure you're winsock functions converted to the array style, then use a For loop to send multiple messages thru however many you made. You could even make a for loop for creating the controls... get up to like 1000 going at once that'd be interesting.

Dasher
2002-10-29, 12:40 PM
Sounds like a good way to clog up a network lol. No what I ment was that I was building an object to translate the messages that are sent and received and an object to keep user info and access priority. For example a msg consisting of 47563933 would be sent to a new object where that info would be stored and/or cause the object to perform some action. Right now it uses no objects it just translates the msg as it comes in. The number of if then and case select statements in one function or procedure are getting out of hand. New question. I am thinking of having it scan IP address looking for another computer with the software on it that will answer back. Right now I use a static IP on the server machine and all the clients log in there first.

drivehappy
2002-11-01, 09:07 PM
Hmm well to answer your question, you could do 2 things. The first thing you could do is have your server scan a range of ip addresses, using a for loop. Or you client could automatically try to connect every 15 seconds or so, using a timer object. This last one i've tried, but a long time ago, and i believe i made it search really fast (like try connecting over and over again within a second), this resulted in an error, which if my memory serves was something like this: you can't attempt more than like 34,000 connections on the wns control. I dont know, you could try this, i dunno. If you have anymore questions, feel free to post