LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP write error 1

Solved!
Go to solution

Greetings,

 

I've been working on a small sound card oscilloscope project and I've been stuck getting an error code 1 when I try to do a TCP Write. (I want to sample on a server sound card, send the waveform over TCP to a client, and then the client will perform some basic oscilloscope operations.

 

Right now it's not in a very organized state. Comments haven't been added and the state diagram implementation probably isn't ideal. A GUI is probably the last thing I'll come back to, so there is one, but it's a pretty big mess at the moment as well.

 

 

In the code I'm trying to flatten the 1d array to a string to send over TCP, then unflatten it at the client. That doesn't seem to be the problem, however. As I stated, I keep getting an error code 1 on TCP Write on the server. I've eventried changing it to simply write a "hi" string and telling the client to read 2 bytes. No dice, same error.

 

I'm running both on the same machine for now and trying to connect to 127.0.0.1 on port 40000

 

Does anyone happen to have an idea why this error keeps occurring? I'm aware that it stands for "invalid input", but I can't figure out what's invalid.

 

After I can tranfer the data over TCP, my next step will be to cut down on the number of samples I take from the sound card on the server (<1000). It often crashes when I reduce the sampling that low. I haven't tried to solve THIS aspect of the project much myself, so I feel it'd be rude to ask others to invest time in a solution for me. If you happen to know a good suggestion readily for this, I'm all ears. The main problem here is the mysterious error 1 I'm getting.

 

To produce this error:

 

Set both Server and Client to communicate on port 40000. Start the Server and place a probe on the TCP write's error out. Start the client and enter 127.0.0.1 or localhost in the dialog. The error should show up where the probe is.

 

Thanks,

Pheria

Download All
0 Kudos
Message 1 of 5
(10,520 Views)

Have you tried a different port? Its possible something else is already on that port.

 

port 40000 is still in the range of registered ports

 

Well Known Ports: 0 through 1023.
Registered Ports: 1024 through 49151.
Dynamic/Private : 49152 through 65535

---------------------------------
[will work for kudos]
0 Kudos
Message 2 of 5
(10,511 Views)

Yeah, I've tried a few different ones. I just now tried 51765 and 58735. Same results.

 

I even just tried wiring 0 to the listener port on the server for the OS to determine a valid port available for use, then after seeing what it was trying to connect with the client using the same port. When I show execution highlighting and follow errors, it looks like they're able to connect to each other okay, but I'm still not sure why I'm getting this error 1 at TCP Write.

0 Kudos
Message 3 of 5
(10,505 Views)
Solution
Accepted by topic author Pheria

You've confused the TCP Listener ID with the TCP Connection ID.  In the waiting state, there is a "Connection ID" output from TCP Wait on Listener, and that is the reference that you need to connect to TCP Write.  Writing to the Listener ID causes an error.  A listener can accept multiple connections on the same port, and each connection is assigned its own ID when the connection is established.  This allows you to write a server that can handle multiple connections on the same port at a time.

Message 4 of 5
(10,495 Views)

Agh! You're absolutely right, thank you. I'd been stuck on this for quite some time. It looks like I have some more problems, but I can move forward now and try to address them having crossed the last hurdle.

 

Thanks for your time.

-Pheria

0 Kudos
Message 5 of 5
(10,489 Views)