Looking for a little VB6 guidance

dullard

Elite Member
May 21, 2001
25,914
4,506
126
I'm a self-taught programmer, and so I don't know too much. But I slowly chug along and get things done. I need to adapt one program (which draws data on a picture box) to send that picture box contents wirelessly to one or more laptops every minute or so for 10 minutes.

I looked through the VB6 help files and found the Winsock component. The help file gave examples that I got to work sending text from the main program to one laptop. However, the examples have tons of problems:
[*]Need to know before hand the IP address of the laptops, how do I determine that in VB6? And if I get multiple IP addresses for the same computer, can I send it to any of them?
[*]Is there a simple way to send the picture instead of text?
[*]What ports are typically used?
[*]What type of connection should be used?
[*]What type of errors that I should program for?
[*]Etc.

I think I can work my way through with trial and error, but I figured someone here would have example code, links to freeware code, or even just helpful hints to get me started.

Thanks.
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
Originally posted by: dullard
[*]Need to know before hand the IP address of the laptops, how do I determine that in VB6? And if I get multiple IP addresses for the same computer, can I send it to any of them?

Just use their LAN hostname. Winsock.remotehost = "BASEMENTPC" will work. Whatever the hostname is just specify it in remotehost.

[*]Is there a simple way to send the picture instead of text?
You need to use binary mode instead of ASCII. So use a byte array instead of a string. There's probably a simple example on the net. Try Planet Source Code or vbcode.com.

[*]What ports are typically used?
For local ports, LocalPort property or a random number in the range of client ports (1024-65535). For remote, [Winsock object].RemotePort property.

[*]What type of connection should be used?
TCP/IP protocol. The UDP has the potential to be faster but is unreliable. UDP is used for games.

[*]What type of errors that I should program for?

Here's a good site for samples on using Winsock in VB. Also accounts for error messages I think. http://www.vbip.com/winsock/

Edit: fixed links
 

dullard

Elite Member
May 21, 2001
25,914
4,506
126
Thank you for the start. I've read that entire vbip link and tried it's sample programs. I've downloaded a half dozen codes from the other links. All lead to the same problem:

UDP works without problem, TCP fails to connect.

Could this be related to firewall settings or something like that? I have enabled all ports in each program (UDP and TCP) in the Window's firewall settings. I also selected the programs and gave them full control in the firewall settings.
 

imported_jb

Member
Sep 10, 2004
171
0
0
probably a firewall.. i'm self taught @ VB6 and i made an irc client w/ file sending w/ winsock. don't remember anything weird to get TCP working. http://vbcity.com has a wicked helpful forum also.