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
Try
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)
writer.Flush()
TextBox1.Text = ""
TextBox3.Text = ""
Catch ex As Exception
MsgBox(ex.Message)
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
Listener.Stop()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Start()
Listener.Start()
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
ListBox1.Items.Add(message)
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 01:25 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 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.