Re: Multi-threading with multi-port server



"Rehmet" <rgnurrahmat@xxxxxxxxx> wrote in message news:8f9b7615-8252-4661-9949-8812b735aa00@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi guys,

Can I ask your guidance on how to imeplement server with multi-
threading and multi-port? meaning, I would like my server to receive
audio and video in different ports, and they run concurrently and send
the data to clients.

I am so lost, because I would mess up my .accept and .listen and
setparent if i have videosocket and audiosocket object. I tried and it
just froze.

You don't need multiple threads to handle multiple socket ports. If you use asynchronous sockets then all socket calls return quickly and you can run several sockets concurrently in the main thread.

Whatever you are using for a socket library, see if it supports asynchronous (i.e. non-blocking) sockets. These are available from MFC CAsyncSocket, or from winsock if you use WSAAsyncSelect or WSAEventSelect.

--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Re: UDP performance.
    ... issue - it has traditionally been the source of statements like "FreeBSD's threading implementation is weak/bad/broken". ... And these days ISC can't consciously recommend FreeBSD for use on high-traffic DNS servers because UDP performance has gone downhill since 5.x. ... Dinesh> affect voip applications/servers such as asterisk when run on ... One of the problems ISC diagnosed had to do with the highly unusual workload pattern of UDP: many different threads simultaneously sending using a single socket leading to unnecessary socket buffer contention. ...
    (freebsd-performance)
  • Re: socket setdefaulttimeout
    ... > I'm doing DNS lookups it is important to make sure> that the socket doesn't just hang there waiting for a response. ... > could take advantage of the setdefaulttimeout in the socket module, to> limit the amount of time the sockets take for a lookup. ... Still gethostbyname and its brethren can be a pain for single- threaded event-driven programs, because they can block for significant time. ... Under some older threading systems, ...
    (comp.lang.python)
  • Simple UDP server
    ... I am wondering between Forking, Threading ... and the one describes at the snippet below. ... from socket import * ...
    (comp.lang.python)
  • Re: wx.Yield() during socket timeout
    ... My problem is,the gui becomes unresponsive if the socket ... linux does the program crash, it DOES NOT crash on windows xp. ... You must have a bug in your threading code. ... Threading *is* the correct approach for what you are attempting. ...
    (comp.lang.python)