Multi-threading with multi-port server

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.
0
1/21/2008 3:51:13 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
469 Views

Similar Articles

[PageSpeed] 21

"Rehmet" <rgnurrahmat@gmail.com> wrote in message 
news:8f9b7615-8252-4661-9949-8812b735aa00@l32g2000hse.googlegroups.com...
> 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] 

0
Scott
1/21/2008 5:04:16 PM
If you are using threads (and mfc), you have to call AfxSocketInit() in 
each thread. Also, don't forget that you should be using a ui thread 
(not a worker thread).

But once you have setup your thread structure correctly, the socket 
stuff is the same as for non-threaded.

"Rehmet" <rgnurrahmat@gmail.com> wrote in message 
news:8f9b7615-8252-4661-9949-8812b735aa00@l32g2000hse.googlegroups.com:

> 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.

0
anyone3666 (139)
1/21/2008 9:11:41 PM
See my essay on multithreaded networking.  However, the multithreading and networking is
the least of your problems.  How do you plan to synchronize the streams (I worked on this
as a research project in 1991, at the Information Technology Center at Carnegie Mellon
University, which also happens to be the last "real" job I had...the whole ITC evaporated
at the end of my first year, when IBM yanked the contract because they had lost
US$5,000,000,000 and needed to trim everything in site, and we were a victim).
Synchronizing multiple media streams has all kinds of challenges.

Note that (a) you MUST use CAsyncSocket, not CSocket; using CSocket is a mistake.  (b) You
cannot pass a CAsyncSocket between threads [see my essay].  My essay comes with
downloadable code.

http://www.flounder.com/kb192570.htm

Note, however, that I question the use of multiple threads, since using CAsyncSocket in a
single thread often removes any concerns about the need for multiple threads; not that
using multiple threads is a Bad Thing, but you should evaluate if you need such a complex
solution.
				joe

On Mon, 21 Jan 2008 07:51:13 -0800 (PST), Rehmet <rgnurrahmat@gmail.com> wrote:

>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.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15979)
1/22/2008 10:44:25 PM
Reply:

Similar Artilces:

multi-column data consolidation
Hi guys, here is my problem.... Scenario: - Column A to F are months (Jan to June) - Beneath each month (starting row 2 downwards), text data will b entered. Question: How can I have the six months add up or compiled as a single colum database in another sheet or a separate column in that same sheet? will be adding data every so often under these months and it shoul update the database. Thank you for any assistance/help -- Message posted from http://www.ExcelForum.com Question is not clear to me. Not sure what 'add up or compile' means with text entries Perhaps, in G2 enter =...

email server requirements
Does Microsoft CRM 3.0 Require us to host our own exchange server? Currently our email server is hosted by our web hosting company. Hi kurt, Microsoft recently put out a white paper about Using CRM 3.0 without Microsoft Exchange server. It is available for download here: http://www.microsoft.com/downloads/details.aspx?FamilyID=2417e918-2e30-41db-a3b2-2f800bf76ffe&displaylang=en hope this helps, natasha "kurt4949" wrote: > Does Microsoft CRM 3.0 Require us to host our own exchange server? Currently > our email server is hosted by our web hosting company. ...

Multi profile
I have configured outlook 2007 to use multi profiles. When I close the outloop and re-open to select other profile the profiles select list is not prompted. I have set for prompt for profile. But I observed this, after closing outlook still the task manager shows Outlook.exe is runing..when I kill that and re-open I can see the profiles and select particular. Now my question, why Outlook is runnning though its closed. My setting "Hide when minimized" is already OFF. thanks Hi abcd, have a look in the "Task Manager" under "Process" if Outlook.exe is stil...

Services don't start when server restarts.
The information store and MTA stacks services do not start when server is restarted. How do I fix this problem? Check your Event Veiwer, any errors? What are the associated event id #'s. -- John Oliver, Jr. MCSE, MCT, CCNA, Exchange MVP Microsoft Certified Partner "Micah Pokorney" <micah@primeadvantage.com> wrote in message news:137f01c3df7d$df537300$a501280a@phx.gbl... > The information store and MTA stacks services do not > start when server is restarted. How do I fix this > problem? ...

A question about thread,please help me #2
My program environment is .net2005.The partial code is shown as below: void CfinalView::OnRButtonDblClk(UINT nFlags, CPoint point) { CRect rc; GetClientRect(&rc); if(point.x>rc.left&&point.x<(rc.right/2)&&point.y>rc.top&&point.y<rc.bottom) { //AfxBeginThread(RUNTIME_CLASS(CDetailPlot)); } if(point.x>(rc.right/2)&&point.x<rc.right&&point.y>rc.top&&point.y<(rc.bottom/2)) { //AfxMessageBox(_T("haha")); AfxBeginThread(RUNTI...

Mac Stuff CDs, A to Z, updated 15/Jan/2006, and Win & Mac programs, 'WinMac', 'PC/MaC', 'Win-Mac', 'Multi', 'Multi-Platform', 'MultiFormat', 'MULTIOS', 'HYBRID'
Mac Stuff CDs, A to Z, updated 15/Jan/2006, and Win & Mac programs, 'WinMac', 'PC/MaC', 'Win-Mac', 'Multi', 'Multi-Platform', 'MultiFormat', 'MULTIOS', 'HYBRID' GARAGE SALES, buy, risk-free purchase, working, tested, fully functional, very cheap discounted price, low cost, quality OEM software, -------------------------------------------------------- Abvent Artlantis v4.5 Mac 1CD Abvent.PhotoCAD.v1.0.MacOSX ACD.Systems.Canvas.X.0.2.925.MacOSX Adobe.Acrobat.7.0.Pro.for.Mac.OS 1CD Adobe Acrobat 6.0.0 Professional Mac OSX 1CD ...

SQL Server 2005 and 2008
All of my databases are currently in SQL Server 2005. Thus, I have SQL Server 2005 Management Studio installed on my machine to connect to my SQL Server 2005 instances. We now have a SQL Server 2008 instance setup and I want to know if I connect to a SQL Server 2008 database via my current Management Studio? Should I be upgrading to the 2008 version? Also, is it possible to create Maintenace Packages to backup my SQL Server 2005 database from my SQL Server 2008 server? I want to start setting up new Maintenance Plans on the 2008 box if that's possible? Finally, I have S...

Multi-threading with multi-port server
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. "Rehmet" <rgnurrahmat@gmail.com> wrote in message news:8f9b7615-8252-4661-9949-8812b735aa00@l32g2000hse.googlegroups.com... > Hi guys, > > Can I ask your guidance on how to imeplement serve...

Moving CRM to new server
Hi there. I'm planning on soon moving CRM (program files and databases) from one server in our current domain to a new server in the same domain. From what I've seen the CRM Redeployment tool is used for moving CRM from one domain to another. Is it overkill/unnecessary for what I plan to do? What are the best practices under such a scenario? Thanks in advance to anyone who can help. ...

Outlook 2002 "exchange server not available"
Hi, when i try to connect to my mailbox, with my outlook 2002 on a exchange 5.5 server. I get the message "Microsoft exchange server is not available" when i try to open outlook. The funny part is that i can open my mailbox on the terminalservice. I have tried to repair windows, reinstall office and reconfigure my mail settings, none of them worked. plz. help me! Regards Torben ...

threads won't close and then reopen correctly...
I have a MFC VC++ project that has a thread started in the OnInitDialog() function of a dialog box. AfxBeginThread(ThreadProcess, (LPVOID) this, 0); I handle the thread in the the following function UINT Questions::ThreadProcess(LPVOID param) { //do some stuff AfxEndThread(0); return 0; } Everything works well until I close the dialog box and then reopen it. When I do that the thread doesn't work as it should the second time around. Anyone have any thoughts on why I am getting this unwanted behavior and what I can do to correct it? Thanks in advance, RABMissouri2008 "RAB&...

Can't open the link to a reply to a thread I posted
Hi Everyone, I received a reply to a question RE Excel/Office, but when I try to open the link, the page except for the header is blank. Have you ever had that happen, and what can I do to fix it? I really appreciate the help and goodwill that you send my way. Hopefully, I can reciprocate, somewhere. RkyMtn. "RkyMtn" <RkyMtn@discussions.microsoft.com> wrote in message news:CBAFD12E-DA58-454D-8241-79B95002394C@microsoft.com... > Hi Everyone, I received a reply to a question RE Excel/Office, but when I > try > to open the link, the page except for the header is bla...

Office autoupdate via proxy server?
What is the download page that I need to install to proxy rules, so that I can use autoupdate with Microsoft office 2004 Mac? On 1/8/08 3:27 AM, in article ePFD6leUIHA.5404@TK2MSFTNGP03.phx.gbl, "Jyrki" <jyrki@netti.fi> wrote: > What is the download page that I need to install to proxy rules, so that I > can use autoupdate with Microsoft office 2004 Mac? I'm not an Exchange users so not familiar with proxy rules, but this page contains links for Office Mac updates. Downloads <http://www.microsoft.com/mac/downloads.aspx> -- Diane, Microsoft Mac MVP (MVP...

Multi Store Workflow Question
We have one store and a warehouse. We need to order and receive items at the warehouse and transfer them to the store. We need the store to be able to see what is on order and all inventory at the warehouse. Is anyone doing something like this, and how easy it it? At a recent demo, this required many steps, logging into 3 different databases, doing updates, etc. Very confusing for simple tasks we need to do every day. Marvin: Microsoft RMS HeadQuarters would be the solution for you. You can view the inventory in Warehouse and items on order from the Store Mihir Shah Diviasoft, In...

I want to allow forwarding through the exchange server
Here is my problem I have a user that has signed up with a new webinar company. What they do is when you are online with them is you enter the e-mail addresses of the receipients and then send an invite. They send the email to the recipioents from there exchange server and it shows from XXX.com they also send a reply to as the originators e-mail address ourdomian.com. What happens is the originator of the message will receive an NDR for all emails that were sent to ourdomain.com that says the return to is spoofed. How can I allow this in the exchange server and still be safe. By th...

2 servers of dpm
hi i have a dpm 2007 server and i am doing backup for 12 agent on the disks i need to do backup on a tape but the tape is on the second server i need to know how to configure the second server to backup the same agent of the first server thanks for all the support Here is the article which helps you how a library can be used by two DPM servers: http://technet.microsoft.com/en-us/library/cc766563.aspx. Thanks, Praveen D [MSFT] This posting is provided "AS IS" with no warranties, and confers no rights "Geoges sawaya" <Geoges sawaya@discussions....

Change SQL Server Name and Reporting Services Impact?
Folks: Need help ! I want to move my CRM 3.0 SQL Server 2000 Databases from SERVER1 to SERVER2 (no change in SQL version). In our environment the Reporting services is on different server. Will only copying the databases and restoring it on SERVER2 and then changing the server name using Deployment Manager work? Is there anything I need to do apart from restoring databases and copying the msdb crm jobs? Our Envirnonement: ------------------------- SERVER1 (Old Server) --------------------------- SQL Server Databases version 2000 - Organization_Name_MSCRM - Organization_Name_METABASE - ...

Exchange server down or http service is disable
Hi all, i have exchange server 5.5 at winnt 4. Now i find the mesg popup "Exchange server down or http service is disable" after i login the OWA. This event only appear at the IE. use the default langage in English. At Chinese langage is not appear this problem.........please advice Try the steps in this article and see if this is the problem 180417 XWEB: Error Message: Sorry! The Microsoft Exchange Server Is Down http://support.microsoft.com/?id=180417 216377 XWEB: Error - Sorry! The Exchange Server is Down When Using Address Book http://support.microsoft.com/?id=216377 Hop...

I have a problem connecting to our mail server using Outlook 2003
I can't connect to our server and i don't know why.What shall I do? Post a lot more details on your issue? -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -What do the Outlook Icons Mean? -Create an Office 2003 CD slipstreamed with Service Pack 1 ----- "Alaa" <Alaa@discussions.microsoft.com> wrote in message news:25C24420-1711-4D74-858F-3682DB2FE9CC@microsoft.com... >I can't connect to our server and i don't know why.What shall I do? ...

Multi axis chart
Hi, I want to show a stacked chart, ie 4 products sales value in a given month. But then compare it to the prvious years results. I know you could use a 3D chart to show 3 axis, however I can't find how to have the 2 axis (last year and this year) stacked. Hope you understand what I'm asking A 3D chart is more likely to obscure than show anything. I'm not sure what you're looking for. Perhaps a stacked-clustered column chart, where each column in the cluster has the four stacked values for each year. http://peltiertech.com/WordPress/2008/05/19/clustered-stacked-co...

How do I find my microsoft exhange server?
i can not get my microsoft outlook to work. says i need a microsoft exchange server? Outlook doesn't require an Exchange Server to work. If you are a home/small bus user that works with POP3/IMAP accounts offered by your ISP, Outlook works fine. Can you tell us which version of Microsoft Office/Outlook you have installed so we can point you in the right direction on how to setup Outlook to work with your preferred account type? "michele" <michele@discussions.microsoft.com> wrote in message news:2B74D0BA-280D-41FA-A7BE-7ED0FF2A11CC@microsoft.com... >...

Leave Messages on Server Checkbox
Greetings, In Outlook 2003, I want to uncheck "leave messages on server" and leave it unchecked as default. It only works during a current instance of running the program. Once I exit and re-start, the box is checked again and I don't want to leave messages on server, or need to go six steps deep into the program each time I run it to uncheck the option. I'm not using exchange, just regular pop3 mail from my ISP. Any help is appreciated, thanks. --Mark ...

Watching Threads I Start
Running Live Mail under W7 I have 'Mark threads I start as watched' checked. My first post when I start a thread shows up red but replies to that thread do not. If I have view set to show 'hide read messages' they replies are not in red and I have missed some replies. How do I get, if possible, all the replies to my thread to show as watched? Thank you. wysiwyg -- ....winston ms-mvp mail "Jack Gillis" wrote in message news:uD1NZJtTLHA.4980@TK2MSFTNGP04.phx.gbl... Running Live Mail under W7 I have 'Mark threads I start as w...

Multi language
Does anyone know whether Office 2004 has built in additional languages? Say if I buy the Japanese or Spanish version and install on English OS = X, do I=20 have everything in English (GUI)? In Office v.X this did not work. Does = it now? joe <anonymous@discussions.microsoft.com> wrote: > Does anyone know whether Office 2004 has built in additional languages? > Say if I buy the Japanese or Spanish version and install on English OS X, > do I have everything in English (GUI)? In Office v.X this did not work. > Does it now? Considering that the application would need a fairly...

E-Mail Server Anti-Virus
We're running Trend Micro SMB Client Security. I installed the trial version of AVG E-Mail Scanner, and it detected an email virus that Trend didn't. What do most of you run? Do you run an anti-virus and an e-mail anti-virus scanner? I'm just reluctant to ditch the AVG and just keep running with the Trend Micro if it didn't catch that virus. You will find lots of opinions on this. Some run both file level and exchange aware AV, some one or the other. MS runs file level only with the caveat that it must be configured correctly to ignore all exchange files/databases/queues, ...