22858 total geeks with 3297 solutions
Recent challengers:
best bread maker
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
sefo
anilg, new comments are deleted automaticall y because of some abuse recently
anilg
this is plain wierd. I submitted comments twice to article 950, and they dont seem to be there. Something wrong with the comment code?
CodeX
shout-boxes in general are old + the staff thing happened to everyone after an issue 2 months ago
anilg
/me is no longer staff :(
anilg
Also, osix's shoutbox predated twitter. Heh.

Donate
Donate and help us fund new challenges
Donate!
Due Date: Jul 31
July Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
UK.gov sticks to IE
6 cos it"s more
"cost effective",
innit
T-Mobile UK pumps
out the iPhone 4
Polaroid 300
instant print
camera
NatWest dumps O2
Money
YouTube ups video
time limit
Alleged expenses
fiddlers to face
justice
Nude trampolinist
bounces free from
court
Nexus One phone
rockets to 28,000ft
UK.gov drops £6m on
Google
Fake Firefox update
used to sling
scareware
Slashdot
British ISPs Favour
Well-Connected
Customers
"Bizarre"
Nanobubbles Found
In Strained
Graphene
1-in-1,000 Chance
of Asteroid Impact
In
...
2182?
2 Chinese ISPs
Serve 20% of World
Broadband Users
World"s Fastest
Hybrid OK"d For
Production
Sometimes It"s OK
To Steal My Games
Thermoelectrics
Could Let You Feel
the Heat In Games
KDE SC 4.7 May Use
OpenGL 3 For
Compositing
Perl 6, Early, With
Rakudo Star
Internal Costs Per
Gigabyte —
What Do You Pay?
Article viewer

Introduction to Visual Basic Socket Programming



Written by:dimport
Published by:Nightscript
Published on:2003-06-21 07:19:46
Topic:Visual Basic
Search OSI about Visual Basic.More articles by dimport.
 viewed 153877 times send this article printer friendly

Digg this!
    Rate this article :
Most people might think that Visual Basic and the internet are enemies by nature. Well, they're probably right :) But still, VB coders have the possibility to write client/server-applications within only a few minutes, thanks to then "Microsoft Winsock Control".



Think your a GEEK? Prove it on the Geek Challenges





Introduction to
Visual Basic Socket Programming


Last update: 09.03.2002
by boefe
for



Table of Contents:

Quote:

1 First Steps
2 Basic TCP
2.1 Server
2.2 Client
3 Example Sourcecode
3.1 Server
3.2 Client


1
First Steps


At the beginning, you always have to include this control into your application. You do this by pressing CTRL+T and then selecting "Microsoft Winsock Control 6.0". If you only have an older version of Winsock, don't mind. There shouldn't be any (important) differences.

Secondly, an instance of the Winsock control has to be created inside your main form; most simply by double-clicking the Winsock icon in the "Toolbox" panel.

These first two steps are equal for whatever network application you want to code. Now, you have to differentiate between the use of TCP and UDP, and, of course, between client and server applications. In this tutorial, I'll only discuss how to build a simple TCP client/server-application.

2 Basic TCP

The use of TCP is much more common than the use of UDP. The main reason for this is the fact that UDP does not at all care about what happens to the data it sends across the net, and whether it reaches its host and in which order. TCP, however, can always tell you the current state of connection and also sees after the data, ensuring safe transfer across the internet. Therefore, generally, I would recommend you to use TCP.

So be sure to have the "Protocol"-property set to "sckTCPProtocol".

2.1 Server

What our server does, is listen on a specified port for incoming connections. When someone (a client) tries to connect to your application, you receive an event and are able to allow or to refuse the connection attempt.

What we have to do first, is set the "LocalPort"-property to the port number, on which we want the server to listen. Port numbers can be any integer between 1 and 65.535. It is recommended to choose a number over 1.024. To be (almost) sure that your desired port isn't already in use, I recommend using really high numbers.

Now, the server has to be told to start listening. This is done by calling the "Listen"-procedure. Example code for a typical Form_Load() follows.
Important remark: "sock" is how I called the Winsock control, you can choose any name you like.

Private Sub Form_Load()
  sock.Protocol = sckTCPProtocol ' choose the TCP protocol
  sock.LocalPort = 50505 ' an example port number
  sock.Listen ' tell
Winsock to start listening
End Sub


The server also has to know what to do when somebody tries to connect. Therefore, we have to edit the "ConnectionRequest"-event. In this event's code you can do whatever you want, but if you want to allow the new connection, you HAVE to call the server's "Accept"-procedure.

Private Sub sock_ConnectionRequest(ByVal requestID As Long)
  If sock.State = sckListening Then ' if the socket is listening
    sock.Close ' reset its state to sckClosed
    sock.Accept requestID ' accept the client
  End If
End Sub


What are we doing here exactly? At first, we check the server's "State". Only if the socket is listening ("sckListening") we call "Accept" and the connection is established. Remember to pass "requestID" to this procedure.

Nice. But now we need to go on to data exchange. In order to explain this to you, we will write a most primitive program :] Both the server and the client will have two textboxes in their applications. One showing what we are typing, one showing what the other side is typing. As soon as you change the content of your side's textbox, the text is also updated on the other side.

Thus, I'll add a textbox called "txtMe" and one called "txtOther". As soon as our text gets changed, we will send the new string to the client:

Private Sub txtMe_Change()
  If sock.State = sckConnected Then ' if there is a connection
    sock.SendData txtMe.Text ' send data to the other side
  End If
End Sub


I guess you have already guessed what "sckConnected" might mean ;) Data transfer is done by "SendData", as you can see. The procedure does not expect data in a certain format, you can send strings, numbers, and whatever else you can think of.

It is good practice to check for an established connection before trying to send data, otherwise your program will be terminated with a cryptic error message.

This is what will happen if new data is received:

' insert this line into (General)
Dim strData As String ' string for received data
 
Private Sub sock_DataArrival(ByVal bytesTotal As Long)
  sock.GetData strData ' load received data into strData
  txtOther.Text = strData ' show new string
End Sub

(Note that you have to insert the strData-definition into the "(General)"-section.)

As soon as data arrives, the "DataArrival"-event is triggered. The only information we get is "bytesTotal", the number of bytes we've just received. In our case, we'll just ignore that parameter 8)

You may ask why I declared strData at the start of all code, in the (General)-section, although we do not have to declare variables in VB at all! Well, at first I must say that it is ALWAYS a good idea to declare ALL variables. Secondly, by doing this, VB knows what kind of data it should receive from the socket.

Loading the new data into strData is simply done by calling "GetData". No problems here, I hope.

So far, everything looks fine and should work. We'll only add some code for the event of a suddenly closed socket (e.g. when the client exits).

Private Sub sock_Close()
  
sock.Close ' has to be called
  sock.Listen ' listen again
End Sub


The "Close"-event is called when the OTHER side disconnects. In this case, it is important to call "Close" in order to get the "State" back to "sckClosed". Otherwise it would be "sckClosing", and "Listen" would only result in an error.

Some other error trapping would be a good idea, too:

Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  MsgBox "Socket Error " & Number & ": " & Description
                                    ' show some "debug" info
  sock.Close ' close the erraneous connection
  sock.Listen ' listen again
End Sub


Now that's a long list of parameters coming along with this event which is triggered every time something isn't working the way it should. However, we'll only use "Number" and "Description". Having the "Number", you can browse through MSDN (http://msdn.microsoft.com), for example, in order to get rid of possible bugs in your program. "Description" even gives you a nice, more-or-less understandable summary of the error which just occured. Narf. :]

Compile and run the server. Watch it do nothing ;) - yet...

2.2 Client

Now, let's write the client application. Create a new project, and follow the "FIRST STEPS" from chapter 2 again.

The difference between the client and the server should be clear. While the server waits for anybody to connect from a (firstly) unknown adress, the client needs to know which hostname or IP-adress the server has. That's why we need two new textboxes into which the user has to enter two values: One for the server's adress and one for the port it's listening on. In my example code, I call those boxes "txtIP" and "txtPort". We'll also need a button for connecting and disconnecting which we will call "cmdCon" (of course, such a button could also be added to the server).

When the button is pressed, the following happens:

Private Sub cmdCon_Click()
  If sock.State = sckClosed Then ' if the socket is closed
    sock.RemoteHost = txtIP.Text ' set server adress
    sock.RemotePort = txtPort.Text ' set server port
    sock.Connect ' start connection attempt
  Else ' if the socket is open
    sock.Close ' close it (user disconnected)
  End If
End Sub


This code should be quite
self-explanatory.

One important notice, though: "RemoteHost" must not be mixed up with "RemoteHostIP". While "RemoteHost" has to be set before connecting and can either be a string holding a hostname (for example "localhost") or a string holding an IP-adress (for example "127.0.0.1"), "RemoteHostIP" is automatically set by Winsock as soon as a connection has been established. This is done both on the server and on the client side, and holds the other side's IP-adress.

(Thus, this code would be a nice "feature" to add to our server's "Connection_Request"-event: 'MsgBox "Connected with " & sock.RemoteHostIP'. In the listing at the end of this tutorial, I've inserted this line.)

But now, let's get back to the client. Here's a change to the "Close"-event code:

Private Sub sock_Close()
  sock.Close ' has to be called
End Sub


In contrast to the server, the client does not have to "Listen" again, of course. The same is true for the "Error"-code:

Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  MsgBox "Socket Error " & Number & ": " & Description
                                    ' show some "debug" info
  sock.Close ' close the erraneous connection
End Sub


Another change to the server is the total absence of "Form_Load" and "ConnectionRequest". The things happening in there were only neccessary for the server.

All in all, client and server are not very different. That's why it is very easy to integrate both the server and the client code into one single application, especially for such small programs.

3 Example Sourcecode

Here are the complete source-codes, ready for copy & paste. However, you'll have to insert the Winsock controls, textboxes and command buttons on your own:

Server:
Quote:

1 Winsock control "sock"
2 Textboxes "txtIP", "txtPort"

Client:
Quote:

1 Winsock control "sock"
1 Button "cmdCon"
4 Textboxes "txtIP", "txtMe", "txtOther", "txtPort"


3.1 Server

Dim strData As String ' string for received data
 
Private Sub Form_Load()
  sock.Protocol = sckTCPProtocol ' choose the TCP protocol
  sock.LocalPort = 50505 ' an example port number
  sock.Listen ' tell Winsock to start listening
End Sub
 
Private Sub sock_Close()
  sock.Close ' has to be called
  
sock.Listen ' listen again
End Sub
 
Private Sub sock_ConnectionRequest(ByVal requestID As Long)
  If sock.State = sckListening Then ' if the socket is listening
    sock.Close ' reset its state to sckClosed
    sock.Accept requestID ' accept the client
    MsgBox "Connected with " & sock.RemoteHostIP
                                    ' show who we are connected with
  End If
End Sub
 
Private Sub sock_DataArrival(ByVal bytesTotal As Long)
  sock.GetData strData ' load received data into strData
  txtOther.Text = strData ' show new string
End Sub
 
Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  MsgBox "Socket Error " & Number & ": " & Description
                                    ' show some "debug" info
  sock.Close ' close the erraneous connection
  sock.Listen ' listen again
End Sub
 
Private Sub txtMe_Change()
  If sock.State = sckConnected Then ' if there is a connection
    sock.SendData txtMe.Text ' send data to the other side
  End If
End Sub


3.2 Client

Dim strData As String ' string for received data
 
Private Sub cmdCon_Click()
  If sock.State = sckClosed Then ' if the socket is closed
    sock.RemoteHost = txtIP.Text ' set server adress
    sock.RemotePort = txtPort.Text ' set server port
    sock.Connect ' start connection attempt
  Else ' if the socket is open
    sock.Close ' close it
  End If
End Sub
 
Private Sub sock_Close()
  sock.Close ' has to be
called
End Sub
 
Private Sub sock_DataArrival(ByVal bytesTotal As Long)
  sock.GetData strData ' load received data into strData
  txtOther.Text = strData ' show new string
End Sub
 
Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  MsgBox "Socket Error " & Number & ": " & Description
                                    ' show some "debug" info
  sock.Close ' close the erraneous connection
End Sub
 
Private Sub txtMe_Change()
  If sock.State = sckConnected Then ' if there is a connection
    sock.SendData txtMe.Text ' send data to the other side
  End If
End Sub


Greets, boefe


This article was originally written by boefe

Did you like this article? There are hundreds more.

Comments:
coolnads
2004-01-08 05:27:41
there is problem with my browser or the formatting is bad ??
w0lf
2004-10-26 15:50:50
Fixed
88_bytes
2005-04-22 18:02:53
i want to be able to send string data to and from the client and server.. like a mini messanger =] can you plz assist me or show me how msn: 32bit@gunbound.net
Anonymous
2006-05-10 06:46:01
The tutorial allready clearly explains that...
Anonymous
2006-06-05 10:46:49
can you help me
when i make a double click on Microsoft Winsock Control 6.0 component, it gave me an alert message saying: you don't have a license to use this activeX control
Anonymous
2006-07-15 07:43:44
Multiple clients cannot get ack
Anonymous
2006-08-29 18:39:37
i cannot figure this out, when i press cntrl + t it takes me to the right place i guess but their is no winsock, i have tried and tried to get it but cant find it except on microsoft.com and even then once i have it and try to use it i get the error message, "The file was not registerable as an activeX component" anybody know what i should do or where to go? thx and also i tried to as it as a resource but that didnt work either, even tho it is a .dll file, ugh!
Anonymous
2006-09-10 01:16:08
Really wonderful piece of information for a beginner. I strongly recommend this for all vb programmers
Anonymous
2006-09-24 09:24:51
Hi. I like very much the tutorial I got an addtional learning from it. thanks a lot. But I need help on how to deny an access to the server if user id is already connected. What I mean is if the user id is already connected, it should not be duplicated in the servers' list of connected users or can not used user id that is already connected. Any help for me. Please e-mail me vanix_09@yahoo.com and thanks a lot.
Anonymous
2006-10-02 15:10:58
beautiful, exactly what i needed to get started with network programming! thank you very much!

-Lyle
Anonymous
2006-10-03 03:54:08
connection forcefully rejected, what happen when multipple client connected
Anonymous
2006-10-13 16:54:06
Absoloutely fantastic tutorial for beginners. Great job, nice work on writing it.

*Goes back to google to sort his problem out =[*

Nice work :P
Anonymous
2006-10-17 22:51:43
Since data transfer and receive is so fast, how would I know weither I've done with all transactions outside of sub socket event module before I close the connection
Anonymous
2006-10-18 10:43:48
Cant use this code in VB2005 :-(
Get lots of errors, first of all in the sock_connectionrequest procedure
if Sock.State = sckListening then.....
This returns an error: 'State' is a type in 'AxMSWinsockLib.AxWinsock' and cannot be used as an expression.
Anonymous
2006-10-19 22:22:55
David:
Nice work. Very simple and easy to follow.
Now I need to find a multi threaded server example(or multi process)
Great help. Thanks.
Anonymous
2006-10-23 11:59:46
this bit didnt work for me
If sock.State = "sckListening" Then ' if the socket is listening
Even after i put the scklistening in quotes sock.state still says it cant be used as an expression
JuanFernando
2006-11-05 16:50:40
Felicitaciones. Muy buen tutorial.
Congratulations. Good tutorial.
Anonymous
2006-12-01 11:52:17
Incredibly useful. Easy to Follow and well explained.
Many Thanx Mike
Anonymous
2006-12-05 16:21:29
good could u please mail me tutorial for advanced winsocks my mail abhishek_dutta74@yahoo.com
Domuk
2006-12-07 15:35:01
Sure, we'll get right on that.
Anonymous
2006-12-16 03:52:16
Hi friend,
Really its awesome to getinto socket programmings to begineer!.Thank You.It was much helped me!
Anonymous
2006-12-26 09:09:54
can you help me make a code for a client connnects the server indicate what ipaddress is connecting to the server
esot_dc@yahoo.com
thanx
Anonymous
2006-12-27 18:41:54
well u just do: WinSock.Hostip on the server side
Anonymous
2006-12-27 18:44:22
giving some tips on how to do multiple socket connections would be very much apprieciated.. can't seem to find any good guides anywhere.

main problem im having is being able to control/monitor incoming connections...
Anonymous
2007-01-06 06:18:55
hi. i wrote these codes. but error indicated that "sock.RemotePort = txtPort.Text". error type is type mismatch. i am begining. please help me!!!. my mail adress is "usonnosu_2006@yahoo.com"
Anonymous
2007-01-06 10:05:31
error "sock.RemotePort = txtPort.Text":
you have to type the port before hitting the button, "so I presume"
Anonymous
2007-01-06 10:43:37
tips on how to do multiple socket connections:

You must have multiple winsock controls, an array of controls if you are comfortable with.

client side: not interesting, this can be done with multiple copies of program running.

server side: you need one ear and multiple mouths, that is, one listening socket and array of talkers; in ear_ConnectionRequest do not close your ear, create a new mouth and mouth.Accept talking
Anonymous
2007-02-26 13:00:07
Thanks for the info, I managed to build a simple multiplayer game with it. Can you provide me with an advanced tutorial on allowing clients who are behind a router to connect to the server program? That would be very helpful... matte05 [at] hotmail [dot] com.
Anonymous
2007-03-08 20:15:20
Great code bro!

Keep em coming. =]
travish
2007-03-20 06:25:45
hii does this example works only on LAN or it will work on WAN (outer internet also)..plz reply soon sumit_space@yahoo.co.in
i also made the server clientprogram ..its working on LAN but it can n't send data or messages to the system outer from the Network..means have another internet connection...reply soon
Anonymous
2007-04-02 12:16:37
At the full server code you don't need to add the textboxes txtIP and txtPort but txtMe and txtOther.
Anonymous
2007-05-18 19:20:07
hi buddy excelent job,i need a hand qith how to use the same code in .net,i try but i dont know how,how to change activex to .net?? any help please email me kupa7@hotmail.com
Anonymous
2007-05-31 19:33:40
if txtMe.text doesn't work, try txtMe.value
Anonymous
2007-08-15 07:29:18
can this client-server architecture be used over the internet. I mean my client is a regular machine while the server resides on a machine over the internet with a fixed IP address.
Anonymous
2007-09-05 12:51:41
i am the student at UTM(malaysia).this is the first time i use VB in make the socket programming.could you please help in to explain more detail about using socket programming using VB.my email address is fiezka@yahoo.com
Anonymous
2007-09-06 06:57:15
hi..i could run the client programming bit fail to run the server programming..the error is at sckTCPProtocol...i did not have any idea about this error..could you help me??
fiezka@yahoo.com
Anonymous
2007-09-08 20:51:45
Here is my entire code for a UDP talker and UDP listener in separate forms, using VBA in Access 2003. Text sent from the talker form is displayed in the text box of the listener form.

Server (Talker)-Form has the Winsock control named “UDPTalkerSocket” and a command button named “cmdSendUDP”

Dim MsgCnt As Integer

Private Sub cmdSendUDP_Click()
  ' setup the socket
  MsgCnt = MsgCnt + 1
  If UDPTalkerSocket.State = sckClosed Then ' if the socket is closed
    UDPTalkerSocket.Connect "localhost", 12345
  End If
  
  ' send!!
  UDPTalkerSocket.SendData "Testing UDP" & MsgCnt & vbCrLf
End Sub


------------------------------------------------------------

Client (Listener) )-Form has the Winsock control named “UDPListenerSocket” and a text box named “txtText1”

Private Sub Form_Load()
  UDPListenerSocket.LocalPort = 12345
  UDPListenerSocket.Bind
End Sub

Private Sub UDPListenerSocket_DataArrival(ByVal bytesTotal As Long)
  Dim s As String

  UDPListenerSocket.GetData s
  txtText1.SetFocus
  txtText1.Text = s
End Sub


Anonymous
2008-01-07 13:08:56
how can you test this if u only have one computer?????????
Anonymous
2008-01-10 00:19:25
It works just fine on one machine! In that case you've got interprocess communications, between two VB sessions. One session runs the client code, the second runs the server code. Just use the your machine name (or IP) in the client's IP text box.
Anonymous
2008-04-17 19:33:29
hey, erm, i cant call the winsock thingy, u said take it from the toolbox but its not there, any way to call it from code view? (roflcaeks@hotmail.co.uk)
Anonymous
2008-07-27 14:55:32
WOW Amazing...Nicely explained. Very much important for beginners like me. Can i get more advance tutorials for multiple connections..etc dnyaneshwar20@yahoo.com
Anonymous
2008-08-04 01:38:30
nice tut, just what i needed.
Anonymous
2008-08-11 11:52:22
can only a winsock control handle multiple connection a same time
Anonymous
2008-08-19 03:12:54
if the server i willing to contact to is password protected, how can i forward the password to the host???
thanx - HaTy
Anonymous
2008-08-25 06:48:02
This is very good for beginngers like myself. Is there an example on how to use UDP to send video frames to a server? or client?
Anonymous
2008-09-19 06:19:42
I haven't done network programming with VB before, but I need to do this ASAP for a project at work. This was the first hit I got from google. Your page was one of the most helpful tutorials I have ever read on the internet. Good job on making it so easy to understand!!!
Anonymous
2008-10-14 09:02:33
Thank you VERY much for this tutorial. Extremely well made and explained.
Anonymous
2008-10-28 05:36:55
Simple and clear for the beginners
narshaxx
2008-12-12 04:36:39
very interesting and awesome program!!!
Anonymous
2008-12-16 11:07:55
This is fantastic - thank-you so much for this

I have been trying to get my head around how all this worked for days - this had me sorted in just a few minutes.

fantastic tutorial, very clear and to the point - the demo works perfectly too.

Thanks
Anonymous
2009-01-13 14:40:52
Thanks my Friend
Anonymous
2009-02-07 09:34:32
Thank You so much for this wonderful tutorial.for beginners , you could include how to get the hostname so that client can provide to hostname.
Anonymous
2009-02-22 18:01:52
The tutorial is for a server/client app within the same project or executable. When I try to split it out into two separate applications, to talk to each other, the communications become one-way only. How to fix this???

Thanks
CodeX
2009-02-23 07:45:11
the server is what receives messages and the client is what sends messages, so if you want to have bidirectional communication you need both client and server routines in your program.
man4theearn
2009-02-24 17:08:35
It is Great...........
Thanks ..........
pls wright down more about socket programming.........
Anonymous
2009-03-03 23:54:16
I used this code and it worked fine for server part but on client part when i do
sock.Connect i can see connection request at server end and it accepts the connection succesful but on client side socket status is still connecting. Does server sock need to send any acknoledgement back to client on accepting the connection.
Anonymous
2009-03-04 04:44:47
Dude it is a well wriiten tututorial. thx. was of gr8 help
Anonymous
2009-03-12 20:18:55
good tut man :)
Anonymous
2009-03-13 05:04:54
cool tut...fantastic for beginner..
Anonymous
2009-03-18 12:03:11
Beautiful work here, thank you
Anonymous
2009-03-20 14:13:18
wht an idiot
Anonymous
2009-03-22 03:20:43
Its not working here. Please Help Me....
my email id id kedardesai88@gmail.com
Anonymous
2009-03-24 11:51:43
please send in brief my email id is jitensingh.ce@gmail.com
Anonymous
2009-04-06 13:44:44
Its really a great help for me.
Now I need to try multiple thread part.
Anonymous
2009-04-07 15:33:26
plese put the c# code if any one have
Anonymous
2009-04-22 14:18:45
I need to do this ASAP for a project at work. This was the first hit I got from google. Your page was one of the most helpful tutorials I have ever read on the internet. Good job on making it so easy to understand. online games
Anonymous
2009-05-11 06:18:15
wow
Anonymous
2009-07-14 18:35:57
Since data transfer and receive is so fast, how would I know weither I've done with all transactions outside of sub socket event module before I close the connection.buy drug
Anonymous
2009-08-12 23:02:42
very interesting tutorial, thank you very much
Anonymous
2009-09-12 21:59:04
great tips! Thanks for sharing. good info!! <a href="http://www.learn-how-to-quit-smoking.com">How to quit smoking</a>
Anonymous
2009-09-21 18:52:38
just one error :
Server:
Quote:
1 Winsock control "sock"
2 Textboxes "txtIP", "txtPort"

the 2 textbox on the server should be txtme and txtother... however great job guy!
Anonymous
2009-09-30 08:56:15
>
Anonymous
2009-10-15 05:55:09
This is a wonderful tut for a beginner, nicely explained.But hw it can b used to communicate with multiple clients.
Anonymous
2009-10-22 03:41:31
It's great tutorial, i found it usefull. But i want to extent it, so the message receive by client, can it be written into database table ?

Thanks.
Anonymous
2009-11-03 06:29:34
Giving run-time error '1400'
Anonymous
2009-11-06 10:47:39
VB is way under-rated by most professional/corporate programmers. For many corporate applications, using VB with socket programming can be remarkably more efficient than the more typical MVC web applications (Java/dotNET/Ruby/PHP) that is currently in favor.

Calvin (Wicker Garden Furniture)
Anonymous
2009-11-18 15:03:15
:) WINK WINK
Anonymous
2009-11-21 04:57:01
How To check Socket programming in single Computer?
Anonymous
2009-12-13 05:30:18
Thank you for the really great tips. I appreciate them.

home based online jobs
Anonymous
2009-12-28 21:37:38
<a href="http://www.upholsteredheadboard.net">Upholstered Headboard</a> - we wish you a merry christmas and a happy new year.
Anonymous
2009-12-28 21:42:29
[http://www.upholsteredheadboard.net Upholstered Headboard]
Anonymous
2010-01-06 03:37:59
The tutorial is for a server/client app within the same project or executable. When I try to split it out into two separate applications, to talk to each other, the communications become one-way only.
JamesPaul
2010-01-06 03:43:50
Since data transfer and receive is so fast, how would I know weither I've done with all transactions outside of sub socket event module before I close the connection.

http://www.olmafood.com/
Anonymous
2010-01-06 13:51:07
good one boss. plannin to bring our own lan msssger in office. thks for ur tut
Anonymous
2010-01-15 18:38:35
The post is written in very a good manner and it contains many useful information for me. You have a very impressive writing style. Thanks for sharing.
Anonymous
2010-01-16 13:24:08
This is a wonderful tut for a beginner, nicely explained.But hw it can b used to communicate with multiple clients.jersey
Anonymous
2010-01-29 09:52:56
Thanks, its a very good information of sharing and making people know about the activites that are being carried out.

Digital Printing
Anonymous
2010-02-06 09:34:26
this is Vilas; I like this
xboxps3wow
2010-02-10 08:57:35
I can not understand this, when the press cntrl + t brings me to the right place I suppose, but not your winsock, I have tried and tried to get it but cannot find it, except at microsoft.com and yet once I have and try using it I get the error message, no "the file was registered as an ActiveX component" nobody knows what to do or where to go? THX and I have also tried, since as a resource but not yet work well, even Thomas is a. dll, ugh! andy from free Xbox Live
xboxps3wow
2010-02-10 08:59:37
I can not understand this, when the press cntrl + t brings me to the right place I suppose, but not your winsock, I have tried and tried to get it but cannot find it, except at microsoft.com and yet once I have and try using it I get the error message, no "the file was registered as an ActiveX component" nobody knows what to do or where to go? THX and I have also tried, since as a resource but not yet work well, even Thomas is a. dll, ugh! andy from
<a href="http://freexboxlivenow.info">Free Xbox Live</a>
Anonymous
2010-02-11 00:51:13
This is a very nice tut on XMLsockets, however this tut isn't clear to me about how to get multiple sockets to connect to the server, and how to make the server to send the message back to all connected sockets. if there is anyone that does know, pliz send me an email at bcnobel@gmail.com. Thyxx
Anonymous
2010-02-14 15:19:53
Thanks for your good post propane deep fryer
Anonymous
2010-02-24 02:44:24
Where can I get a download for the sock?!
using vb 2010 trying to make it work
have incorrect sock, please post link for download.
Anonymous
2010-03-11 15:33:39
Thanks for the best article. HID KIT
Anonymous
2010-03-15 01:16:17
Geyaya lng jd ni na site!

Aweber Review
Anonymous
2010-03-15 13:34:21
For the person who client stay in the state of "connecting", I had the same problem, but it's not a problem, to check the state you have to get out of the function and check the state again.
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:


Test Yourself: (why not try testing your skill on this subject? Clicking the link will start the test.)
VB Potpourri: Programming, History And Syntax by batterseapower

A nice little collection of the basics of Visual Basic.
Advanced Programming Techniques by batterseapower

A fiendish test covering some of the more obscure elements of Visual Basic 6.


     
Your Ad Here
 
Copyright Open Source Institute, 2006