sending packet in VB6

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.
Joined
Aug 8, 2001
Messages
413
could you be more specific?? if your trying to send data over a network or the internet, you can use the winsock control
 

motocross95

Thread Starter
Joined
Oct 30, 2001
Messages
110
sorry. Well first sending a packet over a LAN would be nice, but eventually I'd like to make a basic TCP/IP game.
 
Joined
Aug 8, 2001
Messages
413
ok, well winsock is the way to go, it works over LAN and the internet, but i havent been able t make it work over a LAN with a proxy (ie. my school) :D

in your vb app, goto the Project menu and click on components, scroll down the list and check Microsoft Winsock Control

add it to your form, and then use it to send the data. its simple to use, on the recieving program, on the Form_Load do this

Code:
Private Sub Form_Load()
Winsock1.LocalPort = "1000"
Winsock1.Listen
End Sub
that will set the port that you will be receiving the data through, and listen for the incoming connection. on the app sending the data, do this

Code:
Private Sub Command1_Click()
Winsock1.RemoteIP = "xxx.xxx.xxx.xxx"
Winsock1.RemotePort = "1000"
Winsock1.Connect
Do Until Winsock1.State = sckConnected
	DoEvents: DoEvents: DoEvents: DoEvents
Loop
Winsock1.SendData strDataToSend
Winsock1.Close
End Sub
now that was very basic code, but it still would work as you would need code on the ConnectionRequest and DataArrival events of the Winsock control.

check out this site for a great tutorial to start learning winsock

http://www.vbworld.com/internet/winsock/

good luck in your game thingy :D
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top