P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger
P2P Instant Messenger P2P Instant Messenger
P2P Instant Messenger
Go Back  Xtreme Visual Basic Talk > > > P2P Instant Messenger


Reply
 
Thread Tools Display Modes
  #1  
Old 03-29-2012, 09:14 PM
eclifox eclifox is offline
Newcomer
 
Join Date: Mar 2012
Location: Australia
Posts: 6
Default P2P Instant Messenger


I didn't make this code but can someone explain to me how to add more than one client to communicate to add to this code?e.g 3 people to talk or is it not possible?
Code:
Imports System.Net.Sockets
Imports System.Threading
Imports System.IO

Public Class Form1

    Dim Listener As New TcpListener(65535)
    Dim Client As New TcpClient
    Dim Message As String = ""
    Dim ip As String
    Dim twoip As String

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim ListThread As New Thread(New ThreadStart(AddressOf Listening))
        ListThread.Start()
    End Sub

    Private Sub Listening()
        Listener.Start()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ip = TextBox2.Text
        Client = New TcpClient(ip, 65535)

        Dim Writer As New StreamWriter(Client.GetStream())
        Writer.Write(TextBox1.Text)
        Writer.Flush()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Listener.Pending = True Then
            Message = ""
            Client = Listener.AcceptTcpClient()

            Dim Reader As New StreamReader(Client.GetStream())
            While Reader.Peek > -1
                Message = Message + Convert.ToChar(Reader.Read()).ToString
            End While

            RichTextBox1.Text = (Message & vbNewLine & RichTextBox1.Text)
        End If
    End Sub

    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Listener.Stop()
    End Sub

End Class
Reply With Quote
  #2  
Old 04-12-2012, 01:15 AM
Binarybot Binarybot is offline
Newcomer
 
Join Date: Mar 2012
Posts: 3
Default

u can make a module to connect to other IP
with this u can connect as many IP as u want
and send same data to 2 or more IP's
or make separate form for each person as each IP
simple way for this is making new same form

like
dim form as new form = new form1
then connect
or as u want
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger P2P Instant Messenger
P2P Instant Messenger
P2P Instant Messenger
 
P2P Instant Messenger
P2P Instant Messenger
 
-->