views:

39

answers:

2

Is there a way in which the http connection and tcp connection listeners can interact with each other?

I have two separate application modules one is working through http and other requires tcp . I need to do an interaction between these two modules so is there way i can make my http based module interact with tcp based module.

+2  A: 

Two distinct processes won't be able to use the same IP port on a same IP address. Thus, two processes won't be able to use the same incoming stream of data coming out of the TCP connection. If they use different ports, there's no problem.

If the two processes use the same IP port, as HTTP is a protocol that sits on top of TCP, it means that your TCP process can be used as a pipe by the HTTP process. The TCP process will connect to the IP port, do its stuff, and forward the data to the HTTP process that will handle it.

Didier Trosset
+2  A: 

First of all, you need to read up a little on networking concepts. HTTP is what's known as an application level protocol, whereas TCP is what's known as a transport layer protocol. Take a look at the OSI Network Model.

As an example, you can imagine that TCP is the telephone network. It gives you the basic means to connect to another person and speak with them. However, in order to actually communicate you need to speak the same language, such as English or French. That is the application level protocol, HTTP in your case.

So to answer your question, in order for your two applications to to communicate and exchange data they need to make a connection / call using TCP and both be speaking the same language / application level protocol namely HTTP.

Robert S. Barnes