linux fix / linux still use event fd for now
This commit is contained in:
		
							
								
								
									
										12
									
								
								ws/ws.cpp
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ws/ws.cpp
									
									
									
									
									
								
							| @@ -51,6 +51,7 @@ int main(int argc, char** argv) | ||||
|  | ||||
|     CLI::App* transferApp = app.add_subcommand("transfer", "Broadcasting server"); | ||||
|     transferApp->add_option("--port", port, "Connection url"); | ||||
|     transferApp->add_option("--host", hostname, "Hostname"); | ||||
|  | ||||
|     CLI::App* connectApp = app.add_subcommand("connect", "Connect to a remote server"); | ||||
|     connectApp->add_option("url", url, "Connection url")->required(); | ||||
| @@ -60,11 +61,12 @@ int main(int argc, char** argv) | ||||
|     chatApp->add_option("user", user, "User name")->required(); | ||||
|  | ||||
|     CLI::App* echoServerApp = app.add_subcommand("echo_server", "Echo server"); | ||||
|     echoServerApp->add_option("--port", port, "Connection url"); | ||||
|     echoServerApp->add_option("--port", port, "Port"); | ||||
|     echoServerApp->add_option("--host", hostname, "Hostname"); | ||||
|  | ||||
|     CLI::App* broadcastServerApp = app.add_subcommand("broadcast_server", "Broadcasting server"); | ||||
|     broadcastServerApp->add_option("--port", port, "Connection url"); | ||||
|     broadcastServerApp->add_option("--hostname", hostname, "Hostname"); | ||||
|     broadcastServerApp->add_option("--port", port, "Port"); | ||||
|     broadcastServerApp->add_option("--host", hostname, "Hostname"); | ||||
|  | ||||
|     CLI::App* pingPongApp = app.add_subcommand("ping", "Ping pong"); | ||||
|     pingPongApp->add_option("url", url, "Connection url")->required(); | ||||
| @@ -90,7 +92,7 @@ int main(int argc, char** argv) | ||||
|  | ||||
|     if (app.got_subcommand("transfer")) | ||||
|     { | ||||
|         return ix::ws_transfer_main(port); | ||||
|         return ix::ws_transfer_main(port, hostname); | ||||
|     } | ||||
|     else if (app.got_subcommand("send")) | ||||
|     { | ||||
| @@ -111,7 +113,7 @@ int main(int argc, char** argv) | ||||
|     } | ||||
|     else if (app.got_subcommand("echo_server")) | ||||
|     { | ||||
|         return ix::ws_echo_server_main(port); | ||||
|         return ix::ws_echo_server_main(port, hostname); | ||||
|     } | ||||
|     else if (app.got_subcommand("broadcast_server")) | ||||
|     { | ||||
|   | ||||
							
								
								
									
										6
									
								
								ws/ws.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								ws/ws.h
									
									
									
									
									
								
							| @@ -24,9 +24,9 @@ namespace ix | ||||
|  | ||||
|     int ws_ping_pong_main(const std::string& url); | ||||
|  | ||||
|     int ws_echo_server_main(int port); | ||||
|  | ||||
|     int ws_echo_server_main(int port, const std::string& hostname); | ||||
|     int ws_broadcast_server_main(int port, const std::string& hostname); | ||||
|     int ws_transfer_main(int port, const std::string& hostname); | ||||
|  | ||||
|     int ws_chat_main(const std::string& url, | ||||
|                      const std::string& user); | ||||
| @@ -36,8 +36,6 @@ namespace ix | ||||
|     int ws_receive_main(const std::string& url, | ||||
|                         bool enablePerMessageDeflate); | ||||
|  | ||||
|     int ws_transfer_main(int port); | ||||
|  | ||||
|     int ws_send_main(const std::string& url, | ||||
|                      const std::string& path); | ||||
| } | ||||
|   | ||||
| @@ -10,11 +10,11 @@ | ||||
|  | ||||
| namespace ix | ||||
| { | ||||
|     int ws_echo_server_main(int port) | ||||
|     int ws_echo_server_main(int port, const std::string& hostname) | ||||
|     { | ||||
|         std::cout << "Listening on port " << port << std::endl; | ||||
|         std::cout << "Listening on " << hostname << ":" << port << std::endl; | ||||
|  | ||||
|         ix::WebSocketServer server(port); | ||||
|         ix::WebSocketServer server(port, hostname); | ||||
|  | ||||
|         server.setOnConnectionCallback( | ||||
|             [](std::shared_ptr<ix::WebSocket> webSocket) | ||||
|   | ||||
| @@ -10,11 +10,11 @@ | ||||
|  | ||||
| namespace ix | ||||
| { | ||||
|     int ws_transfer_main(int port) | ||||
|     int ws_transfer_main(int port, const std::string& hostname) | ||||
|     { | ||||
|         std::cout << "Listening on port " << port << std::endl; | ||||
|         std::cout << "Listening on " << hostname << ":" << port << std::endl; | ||||
|  | ||||
|         ix::WebSocketServer server(port); | ||||
|         ix::WebSocketServer server(port, hostname); | ||||
|  | ||||
|         server.setOnConnectionCallback( | ||||
|             [&server](std::shared_ptr<ix::WebSocket> webSocket) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user