08-04-2017 09:57 AM
I want to know if it is possible to send both TCP and UDP at the same time on different ports, for a Picozed 7030 FMC carrier card v2? I am currently sending out packets via udp from the board with a UDP listener on the PC, works fine. I tried to send a message via TCP from the PC and have it echoed back (as a test) at the same time on a different port, and i got the error that the board is actively refusing it.
Is it possible to have them both for the Picozed 7030, if so any guidance would be greatly appreciated!
Thank you in advance,
08-04-2017 11:16 AM
Of course you can. Both are IP packets.
However UDP is connection-less and TCP needs a 3-way handshake to form the connection before packets are accepted.
If you are using Linux, the kernel will discard your packet if it does not match any live connection in the box.
TCP also needs other packets to be sent along the payload for flow control. That is why we use LWIP for standalone development.
08-04-2017 01:43 PM
Does it work if you just do TCP? Presumably, you have a TCP socket listening on that port?
I'm not sure what you mean by a message that it is "actively refusing it".
You can certainly have TCP and UDP sending packets and the ports do not have to be different. Of course, they are not sent at exactly the same time. There can only be one packet in each direction at a time, but the stack should handle interleaving them. You don't say what OS and stack you are using.
08-04-2017 02:10 PM
As @hbucher already explained, TCP requires a connection while UDP is connection less.
If you, for example, try to connect to a TCP port where nothing is listening (e.g. with telnet), then you will get a message telling you that the connection was refused, like this:
$ telnet 192.168.0.1 666 Trying 192.168.0.1... telnet: connect to address 192.168.0.1: Connection refused
But this doesn't mean that the other side is blocking you, it just means that there is nothing there listening on that port and the handshake to establish a TCP connection failed.
There could be other reason that a connection fails like firewalls or services actively rejecting your connection, so it would help to know your test setup and the actual error message you are getting.
Hope this helps,
08-06-2017 04:32 PM
@mageo17 do you have the proper TCP listening server running ?
08-08-2017 06:08 AM
My first test consisted of pushing data from the board via UDP with a listener port in C# on the PC side, this works fine and is continuously running reading in the data. My goal is to send a command from the PC to the board via a separate TCP port or if that doesn't work on a separate UDP port.
Can you have two different protocols running on different ports on the Picozed? If so is there a user guide or tutorial/blog you could direct me to, haven't found anything on this topic yet.
Also if I try to use the same protocol but on different ports work instead and would it be better than using the TCP?
08-08-2017 07:12 AM
I found this thread in the forums, that is helpful, still working on a solution. Any pointers is greatly appreciated, thank you.
08-08-2017 04:13 PM
Well, if they both work separately but not when you put them together, the question is how are you coordinating the two? But it sounds like you are sending a TCP command from the PC to the board to tell it to send data back. Why not just read it back on the same TCP connection?
If that does not make sense, and you're using UDP to send the data, I assume you don't mind losing some of it?
Are you using multiple threads? If so, are the priorities such that both will actually run? Also, unless something has changed (and I have not kept up with it), lwip is not thread safe: