7

I am new to ZMQ. I find ZMQ socket implementation much simpler than winsock. But my doubt is that "can a client created using ZMQ TCP socket talk to conventional TCP server?" in other words Can my ZMQ client communicate with a TELNET server implemented using winsock?

2
  • 2
    Generally, no. Check out the documentation though, as they have a mode where their own protocol is deactivated. They use it to implement HTTP in the example, maybe you could use it to implement the telnet protocol, too. Apropos, WinSock is just a network library that implements several protocols like e.g. TCP, UDP and the underlying IP. The point is that your last words "implemented using WinSock" are irrelevant to answer your question. Aug 26, 2014 at 5:39
  • @UlrichEckhardt I got your point. Thank you. Just for an example sake i mentioned winsock.
    – Kumar
    Aug 26, 2014 at 5:52

2 Answers 2

3

No it cannot. ZeroMQ is a messaging library and is not just a pure socket. It uses its own protocol called ZMTP and both endpoints are required to understand it.

1
  • 11
    This is not correct. Since version 4, over a year old, there's a ZMQ_STREAM socket that supports raw TCP. It works very much like a TCP socket (reading whatever the network delivers), with high-speed async writing, and adding the ZeroMQ abilities such as multiple binds and connects. See api.zeromq.org/4-0:zmq-socket#toc18 Sep 6, 2014 at 22:03
3

Yes you can. It's called a ZMQ_STREAM socket. Documentation is here: zmq_socket.txt

A socket of type ZMQ_STREAM is used to send and receive TCP data from a non-ØMQ peer, when using the tcp:// transport. A ZMQ_STREAM socket can act as client and/or server, sending and/or receiving TCP data asynchronously.

When receiving TCP data, a ZMQ_STREAM socket shall prepend a message part containing the identity of the originating peer to the message before passing it to the application. Messages received are fair-queued from among all connected peers.

When sending TCP data, a ZMQ_STREAM socket shall remove the first part of the message and use it to determine the identity of the peer the message shall be routed to, and unroutable messages shall cause an EHOSTUNREACH or EAGAIN error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.