Why does my labview client program not receive the 1-d array sent by the labview server program over TCP? - tcp

the server is executed first, followed by the client.
The client attempts to initiate a TCP connection with the server. As soon as server detects it a "connection ID" is created.
The server attempts to send a "setup" packet to the client by building an array of numbers.
Server labview code
Client labview code
Setup Packet creation code:

Try to turn off your firewall, the code looks valid to me.

Related

Unable to read the Server response messages when WSAECONNRESET error is encountered?

Working on a client application (running on windows) problem which uses asynchronous communication (with sockets) with the database server (running on linux).
The client application hit with WSAECONNRESET error while loading data to the server and the server terminates the socket. I have used the WSAGetLastError function and extracted the error message. The server had send some messages (reporting application specific error message) to the client before terminating the socket with WSAECONNRESET error. The client is unable to extract the last message which is sent by the server (as the socket is closed and "recv" function fails). My question is how to extract the last messages sent by the database server (on linux) to client(on windows) ?
Please note, this case is working fine with linux database server to linux client. I mean, unix socket to unix socket. But problem occurs only with linux socket to windows socket communication.
Appreciate your help Please !!
You can't. 'Connection reset' destroys the connection, and all in-flight data is lost, including any that may be already buffered at the receiver.
You need to fix the problem that causes the reset.

Can a Winsock TCP connection between server and client resume as-was after the server must restart?

Is there a way to save the "state" of Winsock so that the server program can be stopped and restarted and all the client TCP connections continue as though nothing happened, without the clients having to do anything special?
Or is it the case that once a Winsock server process terminates, client connections can only be reestablished through all the usual initialization calls?
A lost/closed connection must be re-established through a new connect handshake. So if you don't want the client to know the server is restarted, you will have to move the existing connection to another process first, then move it back after the restart. You can use WSADuplicateSocket() for that.

Server-Sent Events queries

We have a requirement wherein the server needs to push the data to various clients. So we went ahead with SSE (Server-Sent events). I went through the documentation but am still not clear with the concept. I have following queries :
Scenario 1. Suppose there are 10 clients. So all the 10 clients will send the initial request to server. 10 connections are established. When the data enters the server, a message is pushed from server to client.
Query 1 : Will the server maintain the IP address of all the client? If yes is there an API to check it?
Query 2: What will happen if all the 10 client windows are closed? Will the server abort all connections after a period of time?
Query 3: What will happen if the Server is unable to send messages to client due to unavailability of client like machine shutdown. Will the server abort all connections after a period of time for those client for whom they are unable to send the message?
Please clarify?
This depends on how you implement the server.
If using PHP, as an Apache module, then each SSE connection creates a new PHP instance running in memory. Each "server" is only serving one client at a time. Q1: yes, but not your problem: you just echo messages to stdout. Q2/Q3: If the client closes the connection, for any reason, the PHP process will shutdown when it detects this.
If you are using a multi-threaded server, e.g. using http in node.js. Q1: the client IP is part of the socket abstraction, and you just send messages to the response object. Q2/Q3: as each client connection closes the socket, the request process that was handling it will end. Once all 10 have closed your server will still be running, but not sending data to any clients.
One key idea to realize with SSE is that each client is a dedicated socket. It is not a broadcast protocol, where you push out one message and all clients get exactly the same message. Instead, you have to send the data to each client, individually. But that also means you are free to send customized data to each client.

SignalR not invoking result with DNS alias on client

I connect to my server, which is load balanced for an alias to point to 2 servers, 01 & 02 and it round-robins connections for arguments sake. I can connect to the hub without a problem, and I can even send stuff to the server, but when it goes to return it to the client, I never get my methods invoked. If I bypass the load balancer and use the server name explicitly, it always works just fine.
I'm even tracing it, and I send back the message from the exact originating server with the Clients.Client(clientId).completeJob(stuff), and that executes fine on the server, but if I ContinueWith, it never gets finished.
Oh, and it's connected with server sent events. Am I missing something or is this just not supported?
Server-sent events establishes a long running connection, but unlike WebSockets, it isn't bidirectional. The connection can only be used to push data to the client.
SignalR uses regular XHRs to send data from clients when the WebSocket transport is unavailable. This means that the load balancer will likely route client-to-server hub method invocations to a server different than the one the client originally established a server-sent event connection with.
The server executing Clients.Client(clientId).completeJob(stuff) likely doesn't own the connection that would allow it to push a message to the specified client. (Though returning a value from a hub method on the server will send data back to the client via the same connection that invoked the method.)
SignalR can work behind a load balancer. It just requires a little more setup so all the SignalR servers can communicate with each other via a backplane such as Service Bus or Redis. This allows messages to get dispatched to the server that owns the server-to-client connection.
https://github.com/SignalR/SignalR/wiki/Azure-service-bus details how you can setup a Service Bus backplane on Azure.

ASP.NET web page to device connect to server's USB (COM) port

I am working on a way to send commands to an Arduino board from a web site. The Arduino board is connected to the computer via a USB port (a COM port).
I have managed to connect and control the board using a VB.NET program. I also wrote a VB.NET class that can instantiate a COM connection and send and receive messages.
My next step is to basically create a program that will act as a proxy between my web server (IIS 7 running on Windows Vista) and the Arduino board. When a user gets to my ASP.NET page, the page will then send a command to the proxy to open the COM connection. When the connection is open and ready then I can send commands to the proxy. In turn, the proxy will send these commands to the board and listen for the responses it receives from the board. The proxy will then pass these messages back to the ASP.NET page.
I have several questions I hope the group can help me answer...
Am I in the right direction with this approach? Are there easier or more efficient ways of doing this?
The main issue I see occurring is that if a second user opens the web page and tries to open the COM port, there will be an error. Will this cause the first connection to fail? I guess I can first check if the port is already in use and give the second user a message.
Are there any other potential challenges I am missing or not seeing?
Rather than storing the connecting object in the HttpSessionState, store it in the HttpApplicationState so that it is accessible to all users.
You'll need to be careful to synchronize access to the COM port to avoid the serial communication initiated by individual HTTP requests from getting mixed up and confusing the Arduino.

Resources