python server and node.js webclient connection

I made server to Python script that open port 22222 and not http protocol. My client is made node.js(this system is http). And client has attempted connection to python server to 22222 port.enter code here but it didn't connect.

example.

HTTP WEB CLIENT(PORT 80) REQUEST MESSAGE -> PYTHON SERVER (PORT 22222)
HTTP WEB CLIENT(PORT 80) <- PYTHON SERVER (PORT 22222) RESPONSE MESSAGE "1"
HTTP WEB CLIENT(PORT 80) <- PYTHON SERVER (PORT 22222) RESPONSE MESSAGE "2"
HTTP WEB CLIENT(PORT 80) <- PYTHON SERVER (PORT 22222) RESPONSE MESSAGE "3"
HTTP WEB CLIENT(PORT 80) <- PYTHON SERVER (PORT 22222) RESPONSE MESSAGE "4"
HTTP WEB CLIENT(PORT 80) <- PYTHON SERVER (PORT 22222) RESPONSE MESSAGE "connection closed"`enter code here`

is server(not http protocol) and client(http) impossible connection?

Answers


If the two sides aren't speaking the same (or at least a similar) protocol then there's no way to communicate properly.


If your Python server isn't speaking HTTP, you'll have to use Node's net module to talk to it, not Node's http module. HTTP is a well-defined protocol (set of rules about how clients and servers can talk to each other) and Node's http module assumes you're talking to a server that obeys HTTP rules. Since your server doesn't, you need to talk to it with a client that just knows how to speak TCP/IP (which Node's net module gives you), and you'll have to make it follow the protocol yourself.


Need Your Help

Convert Date by TimeZone

java date calendar timezone

In that code above I want to transform a Date by the TimeZone of Server (GMT-02:00) to TimeZone from my Device (GMT-03:00).

Java Regex: Matching the beginning of a line

java regex

I am reading through a number of text files that are a dump of e-mail messages. I am trying to check if the line I am reading starts with "Cc:". For example I would want to match the following ex...