1

I am working on Gateway Simulator which can simulate 1000 gateway.Gateway is connected with the data center and client app is connected with the data center.

Gateway

  1. Stream the video to data center for playing or recording
  2. Respond with status info about sensor connected with gateway
  3. Other status information of the gateway to data center.

Data center query the information from the client

Here gateway may at lenght having 1000 socket.I wanted to know the I/O.Gateway will run on both Windows and Linux developed using c++.Here i have restriction of not to use any third party library.

here how to manage so much connection in gateway. 1. receiving the request from data center which may be 1000 at max. 2. sending the response to data center.

I also need to I/O model required in windows and linux.

Vikram Ranabhatt
  • 7,268
  • 15
  • 70
  • 133

1 Answers1

1

The C10K problem discusses this in great detail and should be enough to get you an understanding of what's involved in accepting a large number of connections.

Jeff Foster
  • 43,770
  • 11
  • 86
  • 103
  • Jeff your talking about third party library.I can't use them.this gateway is going to installed in embedded machine where memory size is limited....suggest something in c++. – Vikram Ranabhatt Mar 24 '11 at 10:02
  • The page discusses various techniques on different OS's. C++ doesn't have any networking libraries in the standard so you've got to base it on something (e.g sockets library). What do you have available on your embedded machine? – Jeff Foster Mar 24 '11 at 10:05
  • I am planning to use overlapped I/O or completion port technique in windows machine there are APi for that in windows but same technique or API is is not available in Linux .can we implement overlapped I/O or completion port in Linux using c++? – Vikram Ranabhatt Mar 24 '11 at 10:13
  • I think ePOLL/kQueue is the Linux equivalent (http://stackoverflow.com/questions/67082/what-is-the-best-epoll-kqueue-select-equvalient-on-windows has more information though) – Jeff Foster Mar 24 '11 at 10:22
  • Jeff this just for my knowledge.Will boost asio will be useful in this scenario.Since boost is supported in both and Linux. – Vikram Ranabhatt Mar 24 '11 at 10:41
  • I think so. Looking at the overview page (http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio/overview/implementation.html) it seems they abstract away the differences, but use overlapped IO on Windows / ePOLL on Linux – Jeff Foster Mar 24 '11 at 10:54
  • @Chris @Jeff Boost.Asio is the way to go here. The latest version is [1.46](http://www.boost.org/doc/libs/1_46_0/doc/html/boost_asio/reference.html). – Sam Miller Mar 24 '11 at 12:23