Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Communications (http://www.xtremevbtalk.com/-net-communications/)
-   -   Client Server App (http://www.xtremevbtalk.com/-net-communications/326037-client-server-app.html)

cyprus1989 06-09-2013 05:39 AM

Client Server App
i want to make a server/client app. i do it but i want to add and something else.When i add a new client,what is send to the server i want also to inform and the other client..here ise the client server:
Option Explicit On
Imports System.IO
Imports System.Net.Sockets
Public Class Form1
Dim client As TcpClient

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
client = New TcpClient(AxWinsock1.LocalIP, 65534)
Dim writer As New StreamWriter(client.GetStream())
Dim nickname As New StreamWriter(client.GetStream())

writer.Write(TextBox3.Text & "say:" & TextBox1.Text)
ListBox1.Items.Add(TextBox3.Text & " say:" & TextBox1.Text)
TextBox1.Text = ""
TextBox3.Text = ""
Catch ex As Exception
End Try
and here is the server user:
Option Explicit On
Imports System.IO
Imports System.Net.Sockets
Public Class Form1
Dim Listener As New TcpListener(65534)
Dim Client As TcpClient

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim message As String
If Listener.Pending = True Then
message = ""
Client = Listener.AcceptTcpClient()
Dim reader As New StreamReader(Client.GetStream())
While reader.Peek > -1
message &= Convert.ToChar(reader.Read()).ToString
End While
End If
End Sub
that i want is to when i creat a new client the send message also i want to go and the other client.
Please help me

All times are GMT -6. The time now is 04:14 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.