Interview Question: Is it mandatory that TCP client and Server must be written in one language i.e. C, C++,C# or Java etc.? Can’t we connect TCP client written in one language to a server written in others?
TCP socket client and TCP server both are independent of each other. We can write tcp client in one language and tcp server in another. Tcp client should only know the IP address and port of the TCP socket server.
[You can read how multiple tcp servers run on same host using different IP address and port combination.]
So, it doesn’t make any difference what language we have used for writing tcp clients and what language for tcp server application. It should work perfectly.
For example, write TCP clients in any languages i.e. C, C++, C# and Java etc. and write TCP server in C++. All Clients and C++ TCP socket server will communicate well.
In a real time complex project we have written multiple servers i.e. UDP server for broadcasting to recognize our specific machines and many TCP servers for multiple operations, in C++ on WinCE and all TCP and UDP clients in C# and C++ for desktop and tablets.
If you want to know about UDP, I have written a real time use of UDP protocol in a project in another interview question.