Identify connection lost between Socket Server and Socket Client in VB.Net - vb.net

Friends,
I wrote a Socket Client which will send the Socket Server some data and get some response from Server. This process will be running once in every 2 seconds.
Now what I need to know is How we can identify the connection lost between Server and Client?
I need this to be implemented in the Client side. If there is no connection then Client should automatically close the connection. Once the connection with the server is available in the next attempt it should connect automatically.
Thanks in advance!

I'm not a vb.net developer, but this is how it works in most languages.
Writing to a lost/closed connection will fail, the client will then know that he needs to reconnect.
It's never possible to know if a connect attemt to a server will succedd before you have done it, so your client should try to reconnect in a loop with a sleep/wait period in between each connection attempt.

Related

How to connect with application server?

I have 3 application servers running on 3 different ports doing the same thing. I want a socket connection between the client and a free application server. How to pass the information of the free server's port number so I can achieve a socket connection. Should I give the client the port number of the free application server?
Currently I am giving the client the port information and achieving a socket connection with the app server.
I am very new to web development and please forgive me for my poor English.

Port change every Time OPC restart

I have Nifi server connected to an OPC server to retrieve Data and send it to Kafka , the problem I have is that every time OPC server restart the port between Nifi and The OPC change and I loose connection , so I have to determine the new port and ask security team to open the New Port , is there any way to fix this Problem in Nifi ? or it should be fixed in the OPC server ?
What you explain seems normal.
When a client connects to a server normally the client's operating system assigns a random port number to the client's connection, that is normal, the one that is fixed is the port on which the server listens.
If the server reboots you will always lose the connection and the client will have to reconnect ... with a different port number
The solution is that the client tries to reconnect automatically if the connection is lost

FTPS client procedure for data connection

I am developping a FTPS client in a Embedded system with LWIP and mbedTLS stacks.
For now, what I do is :
Get an IP adress with DHCP
Get IP address of the server with DNS
Start a TCP connection to the server ( the control connection)
Telling the FTP server that I want to work with the TLS protocol with the command AUTH TLS
Handshake of the TLS protocol with the server
Validate the x509 certificate that the server sends
Telling the client that I want to work in passive mode and that i want to read a file with the command RETR.
Now, I need to open a data connection to read my file. So what I wanted to know is does the data connection is secured in the same way the control connection is ? That means do I have a certificate to validate ? Is the handshake the same ?
If this isn't clear let me know i'm not an expert at all in this area.
Thank you for your future responses
In explicit FTPS connection after you send AUTH command, the data connection is secured all the way. Depending on Active/Passive connection the data connection is opened through port 20(Active) or some random port negotiated(Passive).
You don't need any extra handshakes as far as I know.
You might or might not be able to configure if you want to reuse the same session ID created in opening the control channel. This is related for server to know that data connection has been established by the same client which opened the control channel. Some server require this, some servers allow this, some servers does not support this.

WCF websocket connection close on Windows8

I have a WebSocket WCF based server.
a web (HTML) client is connecting this server using WebSockets.
The server worked well with all clients, till we stumble a client, Chrome (And Firefox) running on Windows 8.1, that fails to connect.
The server receives "Open" request but in Wireshark we see that the connection is closed with unknown reason (21584).
the client shows no message/exception.
From time to time, long time after the failure, the server prints to the log and exception:
The I/O operation has been aborted because of either a thread exit or an application request
What can a reason for such problem? how can we overcome it? or what will be the best way to trace/debug this problem?
thanks.
R.

Need assistance with TCP Reverse connection

I am creating an authentication server for some projects I'm working on. This authentication server works by receiving and transmitting data to users trying to authenticate. The user can send data to the server succesfully but when sending back it requires port forwarding. I read a way that I would not require port forwarding by using reverse connection but I have no idea how to get it working. I found a tutorial and tried to implement but when it tries to connect to read the stream it says the connection is refused.
Any ideas?
If the user is already connecting to the server, why not just keep the (existing) connection open, and use that for bidirectional communication?
I can see no reason to open a second connection from the server back to the client.