Click here to Skip to main content
11,930,231 members (42,719 online)
Click here to Skip to main content
Add your own
alternative version


52 bookmarked

Chatting Application Using DotNet

, 5 Jul 2007
Rate this:
Please Sign up or sign in to vote.
Chatting Application Using VB.Net (ConCurrent Server)

Download - 192.9 KB

Download - 196.7 KB

Screenshot - Server_Form1.jpg

Screenshot - Client_after_Conn.jpg


Simple Chatting Application Using Socket Programming in VB.Net . This Application use TCP Protocol for Communication. So it is Connection Oriented and reliable Service.........


Mainly Background is Socket Programming in VB.NET which use System.Net.Sockets NameSpace...

Client Socket::: TcpClient Class

Server Socket:: TcpListner Class

Socket is Combination of IP_Address and PortNo.. When we create Socket we have to give IP , Port No and Protocol..

Here DotNet give TcpClient Class which is by default use TCP Protocol.. we have to just provide IP And PortNo..

Same way For TcpListner Class also...............

Using the code

Connect Sub Will send Connection Request to server on given ip

after Connection Receive function is started using thread.. because receive function will go in infinite loop so we have to start receive funtion using Thread.otherwise your mainProcess will goes in infinite loop..

// Public Sub Connect()
            ipHostinfo = Dns.Resolve(Txtserver.Text)
            ipAdd = ipHostinfo.AddressList(0)
            remoteEP = New IPEndPoint(ipAdd, 11000)
            th = New System.Threading.Thread(AddressOf Receive)
            i = 1
            MessageBox.Show("Client Connected With Server->" + Txtserver.Text)
        Catch ex As Exception

        End Try
    End Sub

if we use Multi threading architecture we get 1 main Problem Called: Cross Thread Problem

Solve this problem using Delegate Funtion..Here is Solution

 If Me.List.InvokeRequired Then
            Dim d As New SetDisplay(AddressOf Proccessdata)
            Me.Invoke(d, New Object() {str})
Public Sub Receive()
        Dim bytes(100000) As Byte
        Dim bytesRec As Integer
   A:      While True
            bytes = New Byte(100000) {}
            bytesRec = sender.Receive(bytes)
            If bytesRec > 0 Then
                Data = Encoding.ASCII.GetString(bytes, 0, bytesRec)
                Exit While
            End If
           End While
        GoTo A
End Sub
            msg = Encoding.ASCII.GetBytes(Txtmsg.Text)
            Txtmsg.Text = ""
        Catch ex As Exception
        End Try

Points of Interest

Screenshot - Cd_Drive.jpg

This is part of Client Screen.. one intresting point that we can control server Cd Drive From Client Form...

You can Open Notepad , PainBrush ,Calculator On server Machine From Client Screen....

You Can Lock and Release Mouse of Client Pc From the Server....

You Can ShutDown and Restart client Computer From the Server.....

You Can Capture the Photo of Client Screen From the Server......


Keep a running update of any changes or improvements you've made here.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
India India
No Biography provided

You may also be interested in...

Comments and Discussions

Questionniccceeeeeeeeee Pin
ZiZoU3276-Feb-14 5:14
memberZiZoU3276-Feb-14 5:14 
QuestionMulti User Pin
Peyman Mohammadi13-Feb-13 12:10
memberPeyman Mohammadi13-Feb-13 12:10 
GeneralMy vote of 1 Pin
BillaBong1-Mar-11 13:05
memberBillaBong1-Mar-11 13:05 
GeneralMy vote of 4 Pin
Parsagachkar8-Jan-11 22:33
memberParsagachkar8-Jan-11 22:33 
QuestionHow should i Get servers IP? Pin
Parsagachkar8-Jan-11 22:31
memberParsagachkar8-Jan-11 22:31 
QuestionHi Pin
Member 465630230-Mar-09 3:47
memberMember 465630230-Mar-09 3:47 
Generalthankes Pin
goldman141511-Jan-09 8:44
membergoldman141511-Jan-09 8:44 
Questiondoubt for declaration? Pin
gowthamforever24-Dec-08 2:00
membergowthamforever24-Dec-08 2:00 
Questionhow to chat the two system,but there is located in different location Pin
Pandian60212-Jul-08 1:00
memberPandian60212-Jul-08 1:00 
Questionwow Pin
kasif@kasif.org5-Aug-07 3:14
memberkasif@kasif.org5-Aug-07 3:14 
GeneralGreat Article! Pin
RyanPotter3-Aug-07 22:47
memberRyanPotter3-Aug-07 22:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.151126.1 | Last Updated 5 Jul 2007
Article Copyright 2007 by hiteshswce
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid