0

I know this sounds silly, but still I want to know the answer.

can there be an implementation involving tcp server and udp client or vice versa?

2 Answers 2

1

I doubt it. The TCP server is expecting connections using TCP ("stream of bytes") connections over IP, with all of the setup and tear-down mechanics that go along with TCP streams (encapsulated in the TCP stack inside the operating system). A UDP client doesn't use the "stream of bytes" paradigm, but instead sends discrete chunks ("packets") of data. In general, the operating system of the machine where the server is running will look at the protocol type field of the IP packet, see that it is UDP, look around for a matching listener, not find one, and then discard the packet. In the meantime, the server process will have registered with the operating system ("listen") for connections to a specific port for TCP connections. So the OS will have this TCP listen port hanging around never getting any connections, and a continuing series of UDP packets without any UDP listen connection established (and so discard the packets).

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks @Russell. Even I was thinking the same but just wanted a confirmation. A TCP server would expect 3-way handshake before communication where as UDP client won't request for the same.
@VirajPai It's not just that, but yeah. The simplest explanation is that the IP stack in the server's OS is going to look at the protocol code of the IP header, see "UDP", and then never, ever send that packet to the server process' TCP connection.
0

can there be an implementation involving tcp server and udp client or vice versa?

No there can't. They are distinct protocols and the ports occupy distinct namespaces.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.