问题
Does anybody know how to make socket chat in C++ using something like sockets in Java? Is there any way to make ip chat in C++?
回答1:
yes it is possible. You could use a library like Boos.Asio which has an example of chat in its documentation : http://www.boost.org/doc/libs/1_39_0/doc/html/boost_asio/example/chat/posix_chat_client.cpp (client part)
回答2:
Yes to both of your questions. The program would work exactly the same in C++ as it does in Java. You listen on a host/port and send to a host/port. The only difference will be the language and the API used.
来源:https://stackoverflow.com/questions/6820633/how-to-make-socket-chat-in-c