I get an error on the last line of that code. Why?Code:Winsock1.RemoteIP = "127.0.0.1"
Winsock1.RemotePort = 1000
Winsock1.Connect
Dim MyMessage as String
MyMessage = "Hello, My Name Is Steve"
Winsock1.SendData MyMessage
Printable View
I get an error on the last line of that code. Why?Code:Winsock1.RemoteIP = "127.0.0.1"
Winsock1.RemotePort = 1000
Winsock1.Connect
Dim MyMessage as String
MyMessage = "Hello, My Name Is Steve"
Winsock1.SendData MyMessage
By the way, ive tried
Winsock1.SendData (MyMessage)
and I still got the error.
It looks like you are connecting to yourself, do you have a server program runnign to listen on that port? Sorry if I sound insulting.
No, that form that that code goes into listens to 1001, the server form sends from 1001 and listens to 1000. I asked about how many ports before. Since 1 - 1024 are reserved for http and ftp, do you think the internet is screwing me up and giving me these problems? Maybe I should make the ports lke 2000, and 2001?
are you using TCP or UDP?
Every winsock control uses TCP
I may be reading your post wrong but it sounds like you've got the way TCP works a bit mixed up.
When you say:
Winsock1.RemoteIP = "127.0.0.1"
Winsock1.RemotePort = 1000
Winsock1.Connect1
There has to already be a server program listening to port 1000 on your machine, otherwise no connection will be established and thus you cant send any data.
Sorry, this is my first winsock program. What is the different between TCP and UDT?
The main difference between TCP and UDP is that TCP is connection oriented where UDP isnt. TCP is also much more reliable than UDP. But UDP has a much lower overhead for use then TCP.
This link might help you out with using the control:
http://www.vbsquare.com/internet/comms/
Thanks noone! That was the perfect tutorial! Just what I needed! :)
I would put the SendData command in the Winsock_Connect event. If you send the data before Winsock connects, you'll get an error.
No its connected. The start button (where the senddata is) is dissabled until connected.
What error are you getting?
Hold on, for some reason its working......thanks