Client Server App
Client Server App
Client Server App
Client Server App
Client Server App
Client Server App Client Server App Client Server App Client Server App Client Server App Client Server App Client Server App Client Server App
Client Server App Client Server App
Client Server App
Go Back  Xtreme Visual Basic Talk > > > Client Server App


Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2013, 06:39 AM
cyprus1989 cyprus1989 is offline
Newcomer
 
Join Date: Jun 2013
Posts: 1
Unhappy 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
Reply With Quote
Reply

Tags
client-server, networking, server, visual basic


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
Client Server App
Client Server App
Client Server App Client Server App
Client Server App
Client Server App
Client Server App Client Server App Client Server App Client Server App Client Server App Client Server App Client Server App
Client Server App
Client Server App
 
Client Server App
Client Server App
 
-->