Reputation:
I have downloaded the nanomsg library and I know it supports TCP sockets. I am trying to make a simple TCP server in C with it, but it has so many different type of sockets I don't know which one is right for simply making a TCP server. There is pipeline, reqrep, pubsub, etc. So, which one would be best for a simple TCP server?
Upvotes: 1
Views: 1985
Reputation: 6298
Different types of nanomsg sockets are for different purposes.
For example you may not be able to use pipeline since it is unidirectional only. Typically clients talk to server on one to one basis so there is no sense to use pub/sub mechanism.
See short explanation and the code for nanomsg communication patterns here.
The most flexibility for client/server communication would give you NN_PAIR socket type. See complete nanomsg multi client server example.
Upvotes: 3