473,769 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

client close the socket. how the server knows?

rs
how I the client tell the server that the socket is closed? or this there an
even that informs the server that the clients socket is close?

Oh, I am using vb.net 2003

Thanks
Nov 21 '05 #1
4 6736
Untested....

Here is an example. Create a new windows app, add a checkbox a listbox
and
a button. Start the app and check the checkbox to start the server
(clear
it to shut the server down). Once the server has started click the
button
to serialise/deseleralise the object through the socket. Obviously this
works standalone, but start two instances of the app and click the
server
checkbox on one and press the button on the other and you'll see the
exact
same code sending the object to a different app. This app could even be
on
another machine.

Imports System
Imports System.IO
Imports System.Runtime. Serialization
Imports System.Xml.Seri alization
Imports System.Runtime. Serialization.F ormatters.Binar y
Imports System.Net.Sock ets
Imports System.Net

Public Class Form1
Inherits System.Windows. Forms.Form

Private Delegate Sub UpdateListBoxDe l(ByVal Data As String)
Private m_ListenerThrea d As Threading.Threa d
Private server As New TcpListener(IPA ddress.Parse("1 27.0.0.1"), 5000)

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

' Create a new object that is populated with data
Dim obj As New MyObject(1, "Adrian", "Forbes")
' Create an XmlSerializer for the MyObject type
Dim formatter As New XmlSerializer(G etType(MyObject ))

' Create new TcpClient
Dim client As TcpClient = New TcpClient

' Connect to port 5000 on the local machine
UpdateDisplay(" Connecting to client", True)
client.Connect( "127.0.0.1" , 5000)

' Get the underlying stream
Dim stream As Stream = client.GetStrea m

' Seralise out instance of MyObject over the TcpClient's stream
using the XmlSerializer
UpdateDisplay(" Sending..." & obj.ToString, True)
formatter.Seria lize(stream, obj)

' Close the stream
stream.Close()

End Sub

Private Sub StartServer()

' This function is going to run until the server closes
' so set up a var that lets us know we want to run
Dim bRunning As Boolean = True

' Start the server
UpdateDisplay(" Server starting")
server.Start()

While bRunning
Try
' This method will block until a connection is accepted
UpdateDisplay(" Server waiting for connection...")
Dim client As TcpClient = server.AcceptTc pClient()

' Now we have a TcpClient with an underlying stream
' so we want to deserialise our object. This is
' pretty much the sending code in reverse.
UpdateDisplay(" Server connected")
Dim Formatter As XmlSerializer = New
XmlSerializer(G etType(MyObject ))

Dim obj As MyObject =
CType(Formatter .Deserialize(cl ient.GetStream) , MyObject)

UpdateDisplay(" Received " & obj.ToString)
Catch
' If we get an error such as the connection getting
' closed from under us then signal to stop running
bRunning = False
End Try

End While

' Stop the server
Debug.WriteLine ("Server stopping")
server.Stop()

End Sub

Private Sub UpdateDisplay(B yVal Data As String)
' Invoke a call to update the listbox
ListBox1.Invoke (New UpdateListBoxDe l(AddressOf UpdateListBox), New
Object() {Data})
End Sub

Private Sub UpdateDisplay(B yVal Data As String, ByVal Direct As Boolean)
If Direct Then
' This method will update the listbox on this thread
UpdateListBox(D ata)
Else
' Otherwise use this method that will use the listbox's thread
to
' do the update
UpdateDisplay(D ata)
End If
End Sub

Public Sub UpdateListBox(B yVal Data As String)
ListBox1.Items. Add(Data)
Application.DoE vents()
End Sub

Private Sub Form1_Closing(B yVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles MyBase.Closing

If Not m_ListenerThrea d Is Nothing Then
' If the TcpListener is listening then shut it down
StopServer()
End If

End Sub

Private Sub CheckBox1_Check edChanged(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles CheckBox1.Check edChanged
If CheckBox1.Check ed Then
' The server checkbox has been clicked so kick off a new thread
' and run our StartServer method on it
UpdateDisplay(" Starting server")
m_ListenerThrea d = New Threading.Threa d(AddressOf StartServer)
m_ListenerThrea d.Start()
UpdateDisplay(" Started")
Else
' The checkbox has been unchecked so shut the server down
UpdateDisplay(" Stopping server", True)
StopServer()
UpdateDisplay(" Stopped", True)
End If
End Sub

Private Sub StopServer()

' Stop the TcpListener
server.Stop()
' and wait here for the thread to exit. The above call will cause
an
' exception in the listener thread so lets just wait until it is all
' closed up
m_ListenerThrea d.Join()

End Sub
End Class

<Serializable() > _
Public Class MyObject
Public EmployeeID As Long
Public Forename As String
Public Surname As String

Public Sub New(ByVal EmployeeID As Long, ByVal Forename As String, ByVal
Surname As String)
Me.EmployeeID = EmployeeID
Me.Forename = Forename
Me.Surname = Surname
End Sub

Public Sub New()
Me.EmployeeID = 0
Me.Forename = ""
Me.Surname = ""
End Sub

Public Overrides Function ToString() As String
Return EmployeeID.ToSt ring & ": " & Surname & ", " & Forename
End Function

End Class

"rs" <aa@d.com> wrote in message news:aa@d.com:
how I the client tell the server that the socket is closed? or this there
an
even that informs the server that the clients socket is close?

Oh, I am using vb.net 2003

Thanks


Nov 21 '05 #2
Untested....

Here is an example. Create a new windows app, add a checkbox a listbox
and
a button. Start the app and check the checkbox to start the server
(clear
it to shut the server down). Once the server has started click the
button
to serialise/deseleralise the object through the socket. Obviously this
works standalone, but start two instances of the app and click the
server
checkbox on one and press the button on the other and you'll see the
exact
same code sending the object to a different app. This app could even be
on
another machine.

Imports System
Imports System.IO
Imports System.Runtime. Serialization
Imports System.Xml.Seri alization
Imports System.Runtime. Serialization.F ormatters.Binar y
Imports System.Net.Sock ets
Imports System.Net

Public Class Form1
Inherits System.Windows. Forms.Form

Private Delegate Sub UpdateListBoxDe l(ByVal Data As String)
Private m_ListenerThrea d As Threading.Threa d
Private server As New TcpListener(IPA ddress.Parse("1 27.0.0.1"), 5000)

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

' Create a new object that is populated with data
Dim obj As New MyObject(1, "Adrian", "Forbes")
' Create an XmlSerializer for the MyObject type
Dim formatter As New XmlSerializer(G etType(MyObject ))

' Create new TcpClient
Dim client As TcpClient = New TcpClient

' Connect to port 5000 on the local machine
UpdateDisplay(" Connecting to client", True)
client.Connect( "127.0.0.1" , 5000)

' Get the underlying stream
Dim stream As Stream = client.GetStrea m

' Seralise out instance of MyObject over the TcpClient's stream
using the XmlSerializer
UpdateDisplay(" Sending..." & obj.ToString, True)
formatter.Seria lize(stream, obj)

' Close the stream
stream.Close()

End Sub

Private Sub StartServer()

' This function is going to run until the server closes
' so set up a var that lets us know we want to run
Dim bRunning As Boolean = True

' Start the server
UpdateDisplay(" Server starting")
server.Start()

While bRunning
Try
' This method will block until a connection is accepted
UpdateDisplay(" Server waiting for connection...")
Dim client As TcpClient = server.AcceptTc pClient()

' Now we have a TcpClient with an underlying stream
' so we want to deserialise our object. This is
' pretty much the sending code in reverse.
UpdateDisplay(" Server connected")
Dim Formatter As XmlSerializer = New
XmlSerializer(G etType(MyObject ))

Dim obj As MyObject =
CType(Formatter .Deserialize(cl ient.GetStream) , MyObject)

UpdateDisplay(" Received " & obj.ToString)
Catch
' If we get an error such as the connection getting
' closed from under us then signal to stop running
bRunning = False
End Try

End While

' Stop the server
Debug.WriteLine ("Server stopping")
server.Stop()

End Sub

Private Sub UpdateDisplay(B yVal Data As String)
' Invoke a call to update the listbox
ListBox1.Invoke (New UpdateListBoxDe l(AddressOf UpdateListBox), New
Object() {Data})
End Sub

Private Sub UpdateDisplay(B yVal Data As String, ByVal Direct As Boolean)
If Direct Then
' This method will update the listbox on this thread
UpdateListBox(D ata)
Else
' Otherwise use this method that will use the listbox's thread
to
' do the update
UpdateDisplay(D ata)
End If
End Sub

Public Sub UpdateListBox(B yVal Data As String)
ListBox1.Items. Add(Data)
Application.DoE vents()
End Sub

Private Sub Form1_Closing(B yVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles MyBase.Closing

If Not m_ListenerThrea d Is Nothing Then
' If the TcpListener is listening then shut it down
StopServer()
End If

End Sub

Private Sub CheckBox1_Check edChanged(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles CheckBox1.Check edChanged
If CheckBox1.Check ed Then
' The server checkbox has been clicked so kick off a new thread
' and run our StartServer method on it
UpdateDisplay(" Starting server")
m_ListenerThrea d = New Threading.Threa d(AddressOf StartServer)
m_ListenerThrea d.Start()
UpdateDisplay(" Started")
Else
' The checkbox has been unchecked so shut the server down
UpdateDisplay(" Stopping server", True)
StopServer()
UpdateDisplay(" Stopped", True)
End If
End Sub

Private Sub StopServer()

' Stop the TcpListener
server.Stop()
' and wait here for the thread to exit. The above call will cause
an
' exception in the listener thread so lets just wait until it is all
' closed up
m_ListenerThrea d.Join()

End Sub
End Class

<Serializable() > _
Public Class MyObject
Public EmployeeID As Long
Public Forename As String
Public Surname As String

Public Sub New(ByVal EmployeeID As Long, ByVal Forename As String, ByVal
Surname As String)
Me.EmployeeID = EmployeeID
Me.Forename = Forename
Me.Surname = Surname
End Sub

Public Sub New()
Me.EmployeeID = 0
Me.Forename = ""
Me.Surname = ""
End Sub

Public Overrides Function ToString() As String
Return EmployeeID.ToSt ring & ": " & Surname & ", " & Forename
End Function

End Class

"rs" <aa@d.com> wrote in message news:aa@d.com:
how I the client tell the server that the socket is closed? or this there
an
even that informs the server that the clients socket is close?

Oh, I am using vb.net 2003

Thanks


Nov 21 '05 #3
rs
to clearify what i am doing. I building a chat program. many clients
connects to one server. I am using the async socket method. how would
the server know that the socket is closed from the client side.

Thanks
scorpion53061 wrote:
Untested....

Here is an example. Create a new windows app, add a checkbox a listbox and
a button. Start the app and check the checkbox to start the server
(clear
it to shut the server down). Once the server has started click the
button
to serialise/deseleralise the object through the socket. Obviously this works standalone, but start two instances of the app and click the
server
checkbox on one and press the button on the other and you'll see the
exact
same code sending the object to a different app. This app could even be on
another machine.

Imports System
Imports System.IO
Imports System.Runtime. Serialization
Imports System.Xml.Seri alization
Imports System.Runtime. Serialization.F ormatters.Binar y
Imports System.Net.Sock ets
Imports System.Net

Public Class Form1
Inherits System.Windows. Forms.Form

Private Delegate Sub UpdateListBoxDe l(ByVal Data As String)
Private m_ListenerThrea d As Threading.Threa d
Private server As New TcpListener(IPA ddress.Parse("1 27.0.0.1"), 5000)

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

' Create a new object that is populated with data
Dim obj As New MyObject(1, "Adrian", "Forbes")
' Create an XmlSerializer for the MyObject type
Dim formatter As New XmlSerializer(G etType(MyObject ))

' Create new TcpClient
Dim client As TcpClient = New TcpClient

' Connect to port 5000 on the local machine
UpdateDisplay(" Connecting to client", True)
client.Connect( "127.0.0.1" , 5000)

' Get the underlying stream
Dim stream As Stream = client.GetStrea m

' Seralise out instance of MyObject over the TcpClient's stream
using the XmlSerializer
UpdateDisplay(" Sending..." & obj.ToString, True)
formatter.Seria lize(stream, obj)

' Close the stream
stream.Close()

End Sub

Private Sub StartServer()

' This function is going to run until the server closes
' so set up a var that lets us know we want to run
Dim bRunning As Boolean = True

' Start the server
UpdateDisplay(" Server starting")
server.Start()

While bRunning
Try
' This method will block until a connection is accepted
UpdateDisplay(" Server waiting for connection...")
Dim client As TcpClient = server.AcceptTc pClient()

' Now we have a TcpClient with an underlying stream
' so we want to deserialise our object. This is
' pretty much the sending code in reverse.
UpdateDisplay(" Server connected")
Dim Formatter As XmlSerializer = New
XmlSerializer(G etType(MyObject ))

Dim obj As MyObject =
CType(Formatter .Deserialize(cl ient.GetStream) , MyObject)

UpdateDisplay(" Received " & obj.ToString)
Catch
' If we get an error such as the connection getting
' closed from under us then signal to stop running
bRunning = False
End Try

End While

' Stop the server
Debug.WriteLine ("Server stopping")
server.Stop()

End Sub

Private Sub UpdateDisplay(B yVal Data As String)
' Invoke a call to update the listbox
ListBox1.Invoke (New UpdateListBoxDe l(AddressOf UpdateListBox), New
Object() {Data})
End Sub

Private Sub UpdateDisplay(B yVal Data As String, ByVal Direct As Boolean) If Direct Then
' This method will update the listbox on this thread
UpdateListBox(D ata)
Else
' Otherwise use this method that will use the listbox's thread
to
' do the update
UpdateDisplay(D ata)
End If
End Sub

Public Sub UpdateListBox(B yVal Data As String)
ListBox1.Items. Add(Data)
Application.DoE vents()
End Sub

Private Sub Form1_Closing(B yVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles MyBase.Closing

If Not m_ListenerThrea d Is Nothing Then
' If the TcpListener is listening then shut it down
StopServer()
End If

End Sub

Private Sub CheckBox1_Check edChanged(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles CheckBox1.Check edChanged
If CheckBox1.Check ed Then
' The server checkbox has been clicked so kick off a new thread
' and run our StartServer method on it
UpdateDisplay(" Starting server")
m_ListenerThrea d = New Threading.Threa d(AddressOf StartServer)
m_ListenerThrea d.Start()
UpdateDisplay(" Started")
Else
' The checkbox has been unchecked so shut the server down
UpdateDisplay(" Stopping server", True)
StopServer()
UpdateDisplay(" Stopped", True)
End If
End Sub

Private Sub StopServer()

' Stop the TcpListener
server.Stop()
' and wait here for the thread to exit. The above call will cause
an
' exception in the listener thread so lets just wait until it is all
' closed up
m_ListenerThrea d.Join()

End Sub
End Class

<Serializable() > _
Public Class MyObject
Public EmployeeID As Long
Public Forename As String
Public Surname As String

Public Sub New(ByVal EmployeeID As Long, ByVal Forename As String, ByVal Surname As String)
Me.EmployeeID = EmployeeID
Me.Forename = Forename
Me.Surname = Surname
End Sub

Public Sub New()
Me.EmployeeID = 0
Me.Forename = ""
Me.Surname = ""
End Sub

Public Overrides Function ToString() As String
Return EmployeeID.ToSt ring & ": " & Surname & ", " & Forename
End Function

End Class

"rs" <aa@d.com> wrote in message news:aa@d.com:
how I the client tell the server that the socket is closed? or this there an
even that informs the server that the clients socket is close?

Oh, I am using vb.net 2003

Thanks


Nov 21 '05 #4
i already done chat programming similar mirc or pirch chat and also
server/client chat same as msn/aol/netscape, etc.

firstly, u wanted to do server/client chat.....when client connected to
server. the client also send command nick or ip address or both
whichever u like. on server side....the server requested client
connected and accept it by server. u as a server must accepted client
nick or ip address or both to stored in server's listbox. now speaking
about closing by client....when client closed connection...th e client
sent command close or quit, whichever command u liked. then on client
side ....the nick or ip address or both must be removed it from
client listbox. then on server side...the server receiving client
command...the server must accepted client command then server removed
client nick or ip address or both from server lsitbox.....the n take
command nick to broadcasting to all clients connected that client had
left chat room.
hope this help u.
regards,

rs wrote:
to clearify what i am doing. I building a chat program. many clients
connects to one server. I am using the async socket method. how would
the server know that the socket is closed from the client side.

Thanks
scorpion5306 1 wrote:

Untested... .

Here is an example. Create a new windows app, add a checkbox a

listbox

and
a button. Start the app and check the checkbox to start the server
(clear
it to shut the server down). Once the server has started click the
button
to serialise/deseleralise the object through the socket. Obviously

this

works standalone, but start two instances of the app and click the
server
checkbox on one and press the button on the other and you'll see the
exact
same code sending the object to a different app. This app could even

be

on
another machine.

Imports System
Imports System.IO
Imports System.Runtime. Serialization
Imports System.Xml.Seri alization
Imports System.Runtime. Serialization.F ormatters.Binar y
Imports System.Net.Sock ets
Imports System.Net

Public Class Form1
Inherits System.Windows. Forms.Form

Private Delegate Sub UpdateListBoxDe l(ByVal Data As String)
Private m_ListenerThrea d As Threading.Threa d
Private server As New TcpListener(IPA ddress.Parse("1 27.0.0.1"), 5000)

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventA rgs) Handles Button1.Click

' Create a new object that is populated with data
Dim obj As New MyObject(1, "Adrian", "Forbes")
' Create an XmlSerializer for the MyObject type
Dim formatter As New XmlSerializer(G etType(MyObject ))

' Create new TcpClient
Dim client As TcpClient = New TcpClient

' Connect to port 5000 on the local machine
UpdateDisplay ("Connecting to client", True)
client.Connec t("127.0.0.1" , 5000)

' Get the underlying stream
Dim stream As Stream = client.GetStrea m

' Seralise out instance of MyObject over the TcpClient's stream
using the XmlSerializer
UpdateDisplay ("Sending... " & obj.ToString, True)
formatter.Ser ialize(stream, obj)

' Close the stream
stream.Close( )

End Sub

Private Sub StartServer()

' This function is going to run until the server closes
' so set up a var that lets us know we want to run
Dim bRunning As Boolean = True

' Start the server
UpdateDisplay ("Server starting")
server.Start( )

While bRunning
Try
' This method will block until a connection is accepted
UpdateDisplay ("Server waiting for connection...")
Dim client As TcpClient = server.AcceptTc pClient()

' Now we have a TcpClient with an underlying stream
' so we want to deserialise our object. This is
' pretty much the sending code in reverse.
UpdateDisplay ("Server connected")
Dim Formatter As XmlSerializer = New
XmlSerializer (GetType(MyObje ct))

Dim obj As MyObject =
CType(Formatt er.Deserialize( client.GetStrea m), MyObject)

UpdateDisplay ("Received " & obj.ToString)
Catch
' If we get an error such as the connection getting
' closed from under us then signal to stop running
bRunning = False
End Try

End While

' Stop the server
Debug.WriteLi ne("Server stopping")
server.Stop ()

End Sub

Private Sub UpdateDisplay(B yVal Data As String)
' Invoke a call to update the listbox
ListBox1.Invo ke(New UpdateListBoxDe l(AddressOf UpdateListBox), New
Object() {Data})
End Sub

Private Sub UpdateDisplay(B yVal Data As String, ByVal Direct As

Boolean)

If Direct Then
' This method will update the listbox on this thread
UpdateListBox (Data)
Else
' Otherwise use this method that will use the listbox's thread
to
' do the update
UpdateDisplay (Data)
End If
End Sub

Public Sub UpdateListBox(B yVal Data As String)
ListBox1.Item s.Add(Data)
Application.D oEvents()
End Sub

Private Sub Form1_Closing(B yVal sender As Object, ByVal e As
System.Compon entModel.Cancel EventArgs) Handles MyBase.Closing

If Not m_ListenerThrea d Is Nothing Then
' If the TcpListener is listening then shut it down
StopServer( )
End If

End Sub

Private Sub CheckBox1_Check edChanged(ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles CheckBox1.Check edChanged
If CheckBox1.Check ed Then
' The server checkbox has been clicked so kick off a new thread
' and run our StartServer method on it
UpdateDisplay ("Starting server")
m_ListenerThr ead = New Threading.Threa d(AddressOf StartServer)
m_ListenerThr ead.Start()
UpdateDisplay ("Started")
Else
' The checkbox has been unchecked so shut the server down
UpdateDisplay ("Stopping server", True)
StopServer( )
UpdateDisplay ("Stopped", True)
End If
End Sub

Private Sub StopServer()

' Stop the TcpListener
server.Stop ()
' and wait here for the thread to exit. The above call will cause
an
' exception in the listener thread so lets just wait until it is all
' closed up
m_ListenerThr ead.Join()

End Sub
End Class

<Serializable ()> _
Public Class MyObject
Public EmployeeID As Long
Public Forename As String
Public Surname As String

Public Sub New(ByVal EmployeeID As Long, ByVal Forename As String,

ByVal

Surname As String)
Me.Employee ID = EmployeeID
Me.Forename = Forename
Me.Surname = Surname
End Sub

Public Sub New()
Me.Employee ID = 0
Me.Forename = ""
Me.Surname = ""
End Sub

Public Overrides Function ToString() As String
Return EmployeeID.ToSt ring & ": " & Surname & ", " & Forename
End Function

End Class

"rs" <aa@d.com> wrote in message news:aa@d.com:

how I the client tell the server that the socket is closed? or this

there

an
even that informs the server that the clients socket is close?

Oh, I am using vb.net 2003

Thanks



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
4490
by: Michael Rybak | last post by:
hi, everyone. I'm writing a 2-players game that should support network mode. I'm now testing it on 1 PC since I don't have 2. I directly use sockets, and both client and server do computations, the only data transfered is user mouse/kbd input. It works synchronously, but somehow, when I play in client window, both client and server have 17 fps, while when playing in server window, server has 44 fps while client ...
0
1462
by: Usman | last post by:
Hi I'm having problem with a scenarion where I have a server written in C# and client written in VC6++. Here is the server code that i'm using including the Callback function for handling clients. Also there's a commented code where i'm using TCPListener instead of simple Socket Class. The problem i'm having is that when I run this code using Socket class, the server starts well but "OnClientConnect" method never gets called. On...
5
3445
by: Yossarian | last post by:
I have a handheld running CE .NET 4.2 and I am using c# with framework 1.1 to develop a solution for syncing data that is on the handheld with the local pc. Our handheld cradles only support network connections, no usb or serial, so i have to use networking to get the data transfered. Here's the problem. I have the server accepting connections fine, but i'm a little confused how to actually send the server data, and then how the...
14
12794
by: ahlongxp | last post by:
Hi, everyone, I'm implementing a simple client/server protocol. Now I've got a situation: client will send server command,header paires and optionally body. server checks headers and decides whether to accept(read) the body. if server decided to throw(dump) the request's body, it'll send back a response message, such as "resource already exists" and close the connection.
0
1691
by: ankuragt | last post by:
(problem in writing a string into a file on client side.) hey i have written a code of server and client.what i want to do is to transfer the contents of file on server side to the client side (line by line).. the code for server is given as /* A simple server in the internet domain using TCP The port number is passed as an argument */ #include <iostream.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include...
3
2185
by: khu84 | last post by:
Here is client server very simple code, seems to work with telnet but with with web client code gives blank output. Following is the server code:- <? function createSocketServer($host='192.168.1.34',$port=2222) { $max_clients = 10;
5
2804
by: Nash | last post by:
Hi, I am using asynchronous client/server communication. Whenever a client is getting connected to the server the correspoinding socket is added to the list. I want to validate whether the client is really a valid one, for that every client will send some command to server for validation. But the thing is if the client is invalid server will not receive the command at all so the socket will be kept open how should i identify that socket...
1
21416
by: diegoblin | last post by:
Hi, i kind of new to java and i want to transfer a file between a server and a client. I know i have to use InputStream and OutputStream, but i don't know how to do it properly. So far i think i've managed to do the client part. i read the content of a file, "hi.txt", and i send it to the server. The problem is in the server part, i do not know how to write the file in the server. Thanks in advance for your help Here is my code for the...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10047
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7410
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.