Listening and Connecting At The Same Port

I use MFC Visual C++ 4.2.

I have developed a network application using CSocket. 

I am having 3 applications:
Server app, Client app, Broadcaster app. 

If Server app has error and needs to be restarted, Broadcaster was meant to 
be a TEMPORARY Server. And EACH TIME the Server app restarted, it will act  
as CLIENT and connect to the Broadcaster then the Server app will return to 
its ORIGINAL role as Server then Broadcaster app will do 
BroadcastSystemMessage( "WAKE UP" ) to Client application notifying that the 
Server is ready to receive Join request. 

1. I did all this and during DEBUGGING time, I have all process ran 
correctly and all message from Server to Client, Broadcast System Message 
also OK. But when I just run all application, nothing's happened. 

2. I did all this on the same port of 2000. Does the same port used for 
Sending and Receiving will not work? 

Thank you very much.
0
Chris6982 (632)
12/23/2008 5:03:01 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
1914 Views

Similar Articles

[PageSpeed] 22

Are you running all the applications on the same machine?

Is there more than one application listening on the same port on the same 
machine? (this is the only restriction.  If there is already an socket 
listening on port x then when you try to create another one that listens to 
the same port it will fail).

Try putting some logfile outputs or messageboxs in your application to find 
out where and why it fails.

AliR.

"Chris" <Chris@discussions.microsoft.com> wrote in message 
news:33598BF5-E291-4914-9BCB-8A70A1E467D1@microsoft.com...
>I use MFC Visual C++ 4.2.
>
> I have developed a network application using CSocket.
>
> I am having 3 applications:
> Server app, Client app, Broadcaster app.
>
> If Server app has error and needs to be restarted, Broadcaster was meant 
> to
> be a TEMPORARY Server. And EACH TIME the Server app restarted, it will act
> as CLIENT and connect to the Broadcaster then the Server app will return 
> to
> its ORIGINAL role as Server then Broadcaster app will do
> BroadcastSystemMessage( "WAKE UP" ) to Client application notifying that 
> the
> Server is ready to receive Join request.
>
> 1. I did all this and during DEBUGGING time, I have all process ran
> correctly and all message from Server to Client, Broadcast System Message
> also OK. But when I just run all application, nothing's happened.
>
> 2. I did all this on the same port of 2000. Does the same port used for
> Sending and Receiving will not work?
>
> Thank you very much. 


0
AliR3470 (3236)
12/23/2008 4:00:11 PM
See below....
On Mon, 22 Dec 2008 21:03:01 -0800, Chris <Chris@discussions.microsoft.com> wrote:

>I use MFC Visual C++ 4.2.
>
>I have developed a network application using CSocket. 
****
CSocket is usually a very bad choice for robust network code.  In particular, there were
significant bugs in the 4.2 implementation of CSocket that were not in CAsyncSocket.
****
>
>I am having 3 applications:
>Server app, Client app, Broadcaster app. 
>
>If Server app has error and needs to be restarted, Broadcaster was meant to 
>be a TEMPORARY Server. And EACH TIME the Server app restarted, it will act  
>as CLIENT and connect to the Broadcaster then the Server app will return to 
>its ORIGINAL role as Server then Broadcaster app will do 
>BroadcastSystemMessage( "WAKE UP" ) to Client application notifying that the 
>Server is ready to receive Join request. 
*****
How does the broadcaster know it should become a server?  Note that only one process can
own an <IP, Port> pair at a time.  This would require that the broadcaster app detect when
the server fails, and it would then bind the <IP, Port> pair to it, and when it detects
the server is back up, it has to ask the broadcaster to release the <IP, port> pair and
then the server has to rebind it, which seems a bit complex to get right.
****
>
>1. I did all this and during DEBUGGING time, I have all process ran 
>correctly and all message from Server to Client, Broadcast System Message 
>also OK. But when I just run all application, nothing's happened. 
*****
Nothing happens?  What's 'nothing' compared to what is expected to happen.?  If all
processes are running 'correctly', then they should be doing whatever they are supposed to
be doing, so they aren't running 'correctly', but what is happening or not happening?
****
>
>2. I did all this on the same port of 2000. Does the same port used for 
>Sending and Receiving will not work? 
****
That is correct.  One process can own own port.  You cannot use it for two purposes, or in
two processes.
			joe
****
>
>Thank you very much.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
12/23/2008 6:51:50 PM
Reply:

Similar Artilces:

Outlook 2003 cannot connect to server but Thunderbird can!
This is a multi-part message in MIME format. ------=_NextPart_000_001D_01C5232E.1147C0B0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I have Outlook 2003 SP1 and Thunderbird 1.0 on Windows XP SP2. I have the same three email accounts set up in each client and they are = set up ABSOLUTELY IDENTICALLY. Outlook, will on Send and Receive, will return an error message that it = cannot connect to one or more of the accounts. (That in itself is odd = because these mail boxes are ALL on the same mail server and yet Outlook = seems to connect t...

Connect to the internet with word
My computer runs fine and everything, but when I'm typing on word and want to you use the "Look-up" feature it says I'm not connect, I am however connected to the internet but Word doesn't recognize it... any help?? Could it be that your firewall is blocking Word from accessing internet? Yves "BennyCaleny" <BennyCaleny@discussions.microsoft.com> wrote in message news:BC4EAB82-773B-47C3-A004-D3494ABF90AF@microsoft.com... > My computer runs fine and everything, but when I'm typing on word and want > to > you use the "Look-...

Connecting To IIS Newsfeed
This is a multi-part message in MIME format. ------=_NextPart_000_005A_01C61B81.C90C1060 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I have a problem getting my exchange server (SBS 2003) to retrieve news = articles from a windows 2003 server. (standard IIS NNTP service). I created a feed on the server, pointed it to my windows server, set the = date to retrieve articles from to 2000/01/01. I get an event in the log that it ran okay, newsgroup public folders = were created for the newsgroups, but no articles. I set the age lim...

Port that is used to send data from the POS to server
I am trying to integrate a camera system to my POS and I need to know what port RMS uses to send data back and forth across the LAN. Does any one know? thanks! 1433 "joey" <joey@discussions.microsoft.com> wrote in message news:0BAE8FE0-76E0-47E9-9BB0-4045C6959FBF@microsoft.com... >I am trying to integrate a camera system to my POS and I need to know what > port RMS uses to send data back and forth across the LAN. Does any one > know? > > thanks! > 1433 for SQL this si what RMS uses by default unless someone changed it. If theres any headquarters...

Can't get Outlook 2K3 to connect with RPC over HTTPS
Hi all, I am pulling my hair out now. I have followed, to the letter, the steps in article 833401, but I cannot get the Outlook 2K3 client on my laptop to connect to the Exchange server with RPC over HTTP. My server configuration is Windows SBS 2K3, and I have allowed Outlook over the Internet in the ICEW, but it still will not work. The client is XP with SP2 installed, all patches have been applied for Office 2003 as well. I think the problem is on the client side, when I run the outlook /rpcdiag command the CONN column never shows RPC over HTTP. Also looking in the registry on th...

RPC over HTTP with changed SSL Port?
We have Exchange 2003 and Outlook 2003 at work. Many users have been working with OWA just fine (using a changed port for SSL - not 443). Now, we'd like some of those users to use Outlook 2003 with RPC over HTTP. However, Outlook 2003 does not seem to work with our changed SSL port. When we change SSL back to 443, it works fine. Seems Outlook 2003 doesn't allow you to specify the custom SSL port after the URL in the Connection Settings dialog box for Exchange over the Internet. It reads: Use this URL to connect to my proxy server for Exchange: https:// (URL gets typed here) When...

outlook 2003 connecting to exchange server remotely
We're moving our laptop users to OL 2003 and I'm setting up the accounts to point to our exchange server in cached exchange mode but when I dialup off our lan I can't seem to get it to connect. Any ideas? What happens, exactly? Are there error messages? When dialed-in, can you ping the Exchange Server? -- PATRICK REED [Outlook - MVP]~~~~~~ -Microsoft Certified Professional (MCP) -Have you checked http://www.slipstick.com? -Please post your Outlook version! "brain_fart" <williamson_dickie@hotmail.com> wrote in message news:39e401c40151$8cf7b800$a601280...

Outlook 2003 not being updated when showing as connected
One notebook user on a SBS2000 network (using exchange 2000) has been upgraded to outlook 2003. All seemed well for a month and then mysteriously last week outlook messages stopped being updated. In the bottom right of outlook it shows as "Connected" but instead of showing the "All folders are up to date" message the time the folder was last updated is displayed and no new messages are sent or received. To get mail the user has to go offline and then do a manual send/receive. Has anyone any idea what has happened and how I fix? Thanks Paul ...

Can't read Status of Network Connection
Start | Network connections. Select the nic card. Right click, select Status, and nothing happens. The nic is working OK, I can Disable it, enable it, repair it, but I can't read the Status of it. I have tried uninstalling / reinstalling it in device manager. Any ideas how to fix it so I can read the status? cornedbeef007-groups@yahoo.com.au wrote: > Start | Network connections. > Select the nic card. > Right click, select Status, and nothing happens. > > The nic is working OK, I can Disable it, enable it, repair it, but I > can't read the Status o...

Adding Employee's with E-connect 9
I am having some trouble adding employe's using Econnect 9. I recieve a "system error" which doesn't really lead me to any answers as to why I am having this issue. I was able to add customers and Sales Order transactions without a hitch. Here is a copy of both the error message as well as the code I am testing with. hopefully somebody can point me in the right direction. Thanks Error message System.Data.SqlClient.SqlException was unhandled Class=16 ErrorCode=-2146232060 LineNumber=0 Message="System error." Number=201 Procedure="taCreateEmplo...

problem with Outlook making a network connection?
Good afternoon! I have not seen this one before, but it is happening. Here are the details (brief): *Client has e-mail hosted off-site (horrible company, moving to Exchange in the summer)...hosting party just moved the mailboxes from an overtaxed server that was causing a lot of problems to another server this passed weekend. *We have updated the host 'mail' record in the FLZ on the internal DNS Servers in this environment to reflect the change in IP Address (from xxx.xxx.xxx.26 to xxx.xxx.xxx.21). *all users in the environment are using Outlook 2003 SP2 running on Windows XP...

error connecting to the server while send/receeive in progress
My AOL account was correctly added to Outlook, however I am trying to subscribe to other folders in my email and I am reveiving an error (0x800CCC0E) connecting to the server. How do I correct this? ...

crm sales for outlook connected to crm server
Hey, Today i installed without problems a total installation of a W2003 server included with exchange 2003 & SQL & CRM On the client i installed, also without problems the crm sales for outlook client. I made a connection to the crm server, also ok, but i donn't see anything of crm-bottons in outlook, the add-in is ok, the path to the add-in is ok, can someone tells me what maybe cause the problem ? Thanks, Rik The Add in may not have installed properly. Try to remove then add it back in. While in Outlook, remove the Microsoft CRM Outlook COM Add-In and then re-add it back ...

The Connection to Microsoft Exchange is Unavailable Outlook must b
I am running Exchange 2007 with Outlook 2007 on XP SP3. When trying to setup the Outlook client through the wizard, it finds the exchange server successfully but will not allow the mailbox to be created because authentication will not occur. I have on other pcs in the network entered the password multiple times and for some reason it takes and the profile is created. However, it continuously prompts for the password again and does not accept it. I do have other pcs that will not connect at all. Of course, the users are authenticated to the domain successfully while trying th...

Wanna listen to music while surfing...
get the new google search toolbar http://mygooglesearch.ourtoolbar.com/ minimum requirements are Microsoft Windows NT/2000/XP Microsoft Internet Explorer 5.0+ <codelion@gmail.com> wrote in message news:1121675576.796415.90650@g43g2000cwa.googlegroups.com... > get the new google search toolbar http://mygooglesearch.ourtoolbar.com/ > http://radio.ourtoolbar.com is my music, news & pupblic radio toolbar (uses www.EffectiveBrand.com free custom toolbars, not GOOGLE), just want to add that you can play dozens of radio stations right off the page, you do not even have to inst...

Netstat result >>> telnet on port 25
Hi All, Im using SBS 2003 with all the SP for E3 and Hotfixes! I cant connect to SMTP Server but I can work with my POP fine so I try to telnet port 25 and connection refused, I've done the same with port 110 and it worked. I used netstat -an result where Proto Local Address Foreign Ad State TCP 0.0.0.0:25 0.0.0.0 Listening TCP 0.0.0.0:110 0.0.0.0 Listening by this result I assumed that there is no problem, Scrolling down catch my attention Proto Local Address Foreign Ad State TCP 192.168.0.100:25 192.168...

Problem connecting to Hotmail using Outlook 2003
Wondering if anyone is facing the similar problem? Please see the following for the error message:- Task 'Hotmail: Folder:Inbox Synchronizing headers.' reported error (0x800CCCF4) : 'An unknown error has occurred. Please save any existing work and restart the program.' This seems to happen after I installed the ActiveSync 3.7 on my PC. But it never recover even after I had removed it. Hope that someone can look into this matter. Thanks. i do have the same error as you...have you fixed it? because i'm trying to do it since 5 days ago...i'm going crazy...donne...

Remote Desktop Connection 2.0 Beta has expired
My RDC 2.0 Beta has expired and although I am prompted to download a new Beta from the mactopia website, this version also expires on March 31 2008. Anyone know where to get renewed Beta version? Regards Craig. ...

Outlook 2003, "connection to server is offline"
Outlook 2003 (11.8010.8107) SP2 Out of the blue our Outlook is not downloading messages and produces the following error. The server is online. We use the Outlook Connector to our MSN account if that makes a difference. I say out of the blue, but we are setup to download updates automatically so it is possible an update caused the problem I suppose. "Sending and Receiving reported error 0x80040126. The operation cannot be completed because the connection to the server is offline." Any help appreciated. I did do a "Repair" on the Connector, but that did no good. Joh...

Outlook Connection error
I can not get outlook to connect to my isp i get an unable to connect to server Error#0x800ccc0e Anyone know what causes this, it has been working fine for months until now??????? ...

Add application to list when camera is connected
Hi, I'm working on a photo management application, and I want to be able to launch my application easily when I connect my digital camera to my PC. When I connect my camera to my PC, a window pops up showing that windows detected that a "camera connected". This window also has a list of applications with the heading "Select the program to launch for this option". I want to add my application to this list. My question is, how can I do this programmatically? When I install and run the application on another machine, for example, I want my application to automatically a...

How Do I Connect Note P & I Pmt Received w/ Recurring Deposit in B
I have set up an account for money I receive on 2 separate notes from the sale of a business. It amortizes the note fine, but when I enter the recurring payment I receive at the beginning of each month, there is no way I can attach that payment to the note. I can only see the "payee" (who is actually the "payor" since I'm receiving the payment) and not the Promisorry Note 1 and Promisorry Note 2 I have set up in the accounts. So I have no way of tying that monthly payment that is deposited in my checking account to the note receivable asset I have set up. Any...

sending data to com port
Hello, I am using VC++ 6.0 (of Visual studio 6.0) How can I send data to com port via VC++ code ? Need sample code, please. Thanks :) See this article on codeproject..it covers up most of the stuff... http://www.codeproject.com/system/serial_com.asp - Parhar "Eitan" <no_spam_please@nospam.com> wrote in message news:uVpJFP87DHA.1804@TK2MSFTNGP12.phx.gbl... > Hello, > I am using VC++ 6.0 (of Visual studio 6.0) > How can I send data to com port via VC++ code ? > Need sample code, please. > > Thanks :) > > See the "CSerial" class from Tom...

OMA Port Issues #2
Why does OMA/OWA/Exchange have to run on port 80 of IIS. When I change the port number to anything but 80/443 then OMA stops working and says that it cant find the mailbox on the store. Has anyone found a solution to this yet? ...

no internet connectivity
i have tried to post my issue 4 times, and and after waiting hours, i still don't see my posting, so maybe it is because it is too long. so i will try to be really brief - anyway, after reinstalling drivers, beginning with the chipset, i still have no internet connection, even though my device mgr indicates that i have a working ethernet adapter. this issue came about after successfully deleting malware/trojans using malwarebytes. help! I see a previous message from you posted at 1.26 am. Is this a case where the Device Manager is showing a problem device but it still work...