Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Dear

 

I am not getting an idea about how to handel this. i have a client server program, in which server listens for connections and client connects to server

When a PC starts with client software it connects to server and in server list box it shows the avaiable list of connected clients.

 

now here is a problem, if we close the server software and reopen the exe file we are unable to see list of clients which are connected

 

on client it have tried to do this in timer that if server has closed the connections after every 3 seconds client try to check the status of connection

 

if not cntoServer.state <> sckConnected then

 

cntoServer.connect

 

end if

 

but it cause a run time error.

 

can any one have any idea.

The one and only

Dr. Madz

eee-m@il

Posted

You are telling the program this: 'If you are connected, connect.' That makes no sense. :)

 

Should be like this.

 

If cntoServer.state <> sckConnected then

 

cntoServer.Connect

 

End if

 

 

Or:

 

If Not cntoServer.state = sckConnected Then

 

cntoServer.Connect

 

End If

 

 

<> mean Not Equal To

 

Good Luck.

Posted

Hello Dudes you have not checked my Coding i have written

 

IF NOT cn.state = sckconnected

 

Any how I have solved the problem using TCPCLIENT in normal it do not tell it's state i have to use it's protected property ACTIVE

i made a class

Imports System.Net.Sockets
Public Class mClient
   Inherits TcpClient
   Public Property Connected() As Boolean
       Get
           If Me.Active = True Then
               Return True
           Else
               Return False
           End If
       End Get
       Set(ByVal Value As Boolean)

       End Set
   End Property
End Class 

 

no i can check it as

 

if Client.active = then

try to connect it

else

exit sub

end if

The one and only

Dr. Madz

eee-m@il

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...