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
1927 Views

Similar Articles

[PageSpeed] 44

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:

Formula to connect cells in different worksheets?
How do i link an employee to their wage automatically? Is it possible to enter in my employee's name and hours, and have it automatically calculate their wage? I have all my employees wages in another worksheet right now. At this time I go to my job record worksheet I enter in my employee, enter the hours type =left arrow tab to worksheet with wages and click on the employee then hit enter, this gives me there total wage. I am trying to see if I can program the name and wage together somehow, that when I do type the name it calculates with the hours and gives me a total. tb Use ...

serial port: communication.
Hi , I have the follwoing structure: g_CommandsBuffer[S_LastCommandsBufIndex].script_key = MPH_D; g_CommandsBuffer[S_LastCommandsBufIndex].fn = 50; g_CommandsBuffer[S_LastCommandsBufIndex].script_data.mph.classmark_ind.classmark.band_info_field.p_available=0; g_CommandsBuffer[S_LastCommandsBufIndex].script_data.mph.classmark_ind.classmark.band_info_field.e_available=1; g_CommandsBuffer[S_LastCommandsBufIndex].script_data.mph.classmark_ind.classmark.band_info_field.d_available=1; g_CommandsBuffer[S_LastCommandsBufIndex].script_data.mph.classmark_ind.classmark.band_info_field.p_available=0...

To stop a pop up LDAP Directory Connection details?
Each time I start outlook a pop up appears "Microsoft LDAP Directory Connection Dteails. How to stop this pop up? Control Panel->Mail Icon->Directories - Address Book->View or Change->Change. Remove the LDAP service. Back up and install the Outlook Address Book service. I presume this is an upgrade from Office/Outlook 2000? A common issue. -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. How to ask a question: http://support.microsoft.com/KB/555375 After furious head scratching, Parf asked: | Each time I start outlook ...

Exchange 2003 connects Port 1149 / 3045 / 1355 ???
Helo NG, the Firewall Log reports several Drops from our Exchange Server connecting to the Internet. The Ports are 1149 / 3045 /1355 /1083. Have you any Suggestion ? thx Peter ...

GFI MailArchiver Outlook Connection
We are looking at this software as an archiving option instead of upgrading the Exchange server for now. One problem is we would like the users to have access to their stores. We have managed to add a folder to their Outlook profile and then made the default homepage the GFI web interface but this requires either a visit to each workstation or step by step instructions for the individual user. I know that the users can just have a shortcut to the web interface, but it was requested that there be one app not two. Does anyone know of an easier way to set this up? Thanks in advance. ...

POS 2.0 Database Connection has been lost......
At closing, while trying to settle the credit card transactions, we get this message: "The database connection has been lost. When you have resolved the problem, click Reconnect. If successful, POS will reopen, but unsaved work will be lost." This has happened a couple of times in a row and now we find out that customers have been charged multiple times ! The only references I could find in this forum tell me to take my debit card pad off and to restart the SQL service. This hasn't helped, still cannot settle. Anybody any pointers ? Thx I should add that the database i...

Connecting to HQ Manager via IP address
Is it possible to connect to HQ from outside the HQ network? I would like to be able to specify the IP and port like you do in HQ Client to enable me to run HQ Manager from a store location or home office to connect to the HQ database. Any suggestions? -- Dan Rishworth hi Dan, yes it is possible the thing you need is static IP , you can use the ADSL /DSL connection for it and request your ISP to give you dedicated IP that IP you can put to your HQ server (make sure give some security to HQ machine) and then from anywhere in this world you can access your HQ by giving the public IP ...

OPOS Parallel port issue
I had a working machine with two EPSON printers, TM-T88IIIP and TM- U220BP, both parallel. The motherboard died so I replaced with a spare part. This motherboard is all PCI so I had to go get a new PCI parallel interface card since old motherboard had one ISA card. It does have one built-in port so now I have two parallel as before. The problem starts here as the new PCI card is getting CheckHealth error. I'm running OPOS 2.5 sp 9, latest from epsonexpert.com. LPT1, which is configured as the built-in port works fine with two printers. LPT2, PCI, is getting checkhealth error. I alrea...

cannot connect
I'm using wireless between XP PC and this 7 laptop. The XP computer can connect to the laptop but I can't connect the laptop. I see under network that the public profile is used - how do I change this to private? Thanks, I, best advice is to get a router. it is much safer to have a router between you and your broadband Internet connection. some larger ISPs even give out free routers. who provides your Internet service? On Sat, 11 Sep 2010 17:06:52 +1200, "Jason" <jallen@hotmail.com> wrote: >I'm using wireless between XP PC and this 7 laptop. ...

help! laptop w/vista can't get connection
Hi there - I'm so technilogically backwards, I hope I'm in the right forum! Problem: Just moved, and when I did, my internet company (verizon) sent me a new wireless router. THe one I'd used was one I'd purchased, and never had a problem with, but they suggested I get this one. No worries. So, I set it up and have internet on my main computer. However, I cannot set up my laptop to get the internet. I used to live in a house, so there wasn't a worry about other connections nearby. Now I've downsized to an apartment and the only connections I can see are t...

InvalidSecurityContextException trying to connect to WebService
Anyone know, why this might be the case? The user running the client has been setup as supersuer in the Dynamics Security Console Exception type: Microsoft.Dynamics.Security.InvalidSecurityContextException Exception message: Microsoft.Dynamics.Security.NonExistentSecurityObjectException : The security object does not exist. Key = 1 SecurityContext: ApplicationKey: 25cc1a21-2cc4-4b13-a1c8-eea186fb688a ScopeKey: 1 User: IGUSNJEWACCT3V\BizTalkUser Action: GetRoles Input parameters: <RequestObjects> <string>IGUSNJEWACCT3V\BizTalkUser</string></RequestObjects> St...

Unable to Connect to database #2
I'm getting this error when my second register trys to connect to the server When I test the connection under the store adminstrator I get the following response Error #2147467259 [DBNETLIB]{ConnectionOpen(PreloginHandshake()).]General network error. Check your network documentation.(Source:Microsoft OLE DB Provider for SQL Server) (SQL State: 08001) (NativeError: 11) No Help Files available I have on both registers two users one is computer admin the other Limited (same names & passwords). Only if I login as admin on the register that is the server (register 1) I can connect ...

Connection was dropped due to an SMTP protocol event sink
Hello All, Starting about two weeks ago, our Exchange 2003 server started generating a “The connection was dropped due to an SMTP protocol event sink” error, when viewing the Queues, on email sent to AOL, just AOL. A few other domains also fail to send email with the error “The remote server did not respond to a connection attempt” Other domains however, continue to send without error. We are running this on Windows Server 2003. I’ve seen this error all over other boards, but not a mention from Microsoft. Problem is, the solutions presented by non-Microsoft sources fail to resolve...

OL 2003 Connection
It is apparent from this newsgroup and other MS tech support areas that there is a problem connecting to Exchange Server 2000 with OL 2003. I have a 512k ADSL line and managed to get connected first time (LAN router connection), however, I have now wasted many hours of my time (which I won't be able to charge for) trying to get OL2003 to connect to the same (remote) Exchange Server 2000 over LAN routed ISDN without success. It would appear that no matter how long I set the connection timeout in OL2003 to be it times out after approx 30 secs. The ISDN connection is "live" to the ...

Connection Filtering Tab Greyed out
We are in a mixed mode Exchange Org. I am trying to configure Connection Filtering on my Exchange 2003 SP1/Windows 2003 server but when I click on the Connection Filtering tab I get an error and the options are grayed out. The error message references article 818482 but the article doesn't give a work around or solution that works; it states to use Exchange 200O System Manager to do the filtering but E2k ESM doesn't show the Connection Filtering tab. Any ideas? Regards, Brian ...

Informatica Connect to Excel workbook
READER_1_1_1> DBG_21438 Reader: Source is [Romania:Romania], user [PMNullUser] I'll try to connect to an excel workbook with different country sheets containing data, which I want to load into our DWH. Now I'm getting the following error : READER_1_1_1> Fri Dec 03 09:29:24 2004 READER_1_1_1> RR_4036 Error connecting to database [ [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Database driver error... Function Name : Connect Database driver error... Function Name : Connect Database Error: Failed to connect to database using user...

Outlook "connecting to" pop-up
My client is running Outlook on Vista computers in a domain with a SBS2008 server. Every time they start Outlook, they get a pop-up with "Connecting to remote.ajax.com" and prompting for a username/password. remote.ajax.com is the external URL pointing to their IP address. Canceling it seems to cause no further problems. Very annoying, and I've search extensively and find no solutions. Can anyone help? Thanks in advance! -- IT Consultant Heartland Computer chaswood wrote: > My client is running Outlook We are to guess which version of Outloo...

Business Portal connecting to Terminal server with unusual port nu
Hi. I am trying to connect my Business Portal to our terminal server. For security reasons we are using an unusual port number (54903). When we put in just the Terminal server name in the Business Portal area in the site setting, general area for Terminal server we get a 516 error (winsock socket connection failure). if I put in the name of a different server, it works ok (opens a terminal server window). how do I have it redirect to the proper Terminal server with the unusual port number? ...

What is the point of Document Connection?
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel What exactly is the point of Document Connection? I have an Office Live account but I cannot delete items from the workspace from connection, nor can I add folders inside connection to my workspaces. codywilliams@officeformac.com wrote: > What exactly is the point of Document Connection? I have an Office > Live account but I cannot delete items from the workspace from > connection, nor can I add folders inside connection to my workspaces. It allows you to access and modify files on Office Live. It does not e...

Move files that OLE Links are connected to
We are in a network environment. We have run out of space on our main finance server and are going to purchase a new one. However I have over 1000 OLE links linked to the maxed out server. What is going to happen to the OLE links when we move the original files to a new server? Am I going to lose everything? Is there a way that we can run a script of some kind to change the file extension in the OLE link to the new server name without disrupting/losing the links? Jen, Try copy your ole directory in the old server and put it to the new server. After that, change your dex.ini file...

Wireless Connection
Toshiba Laptop w/ XP: I'm not showing any wireless connections in my "Choose a wireless network" screen. I can not update the driver from the device manager, this made me just uninstall the driver and reinstall from Intel's site. After doing this, it works, brings up all connections in my area and I can connect to one of them. But when I turn the computer off and turn back on, whether immediately or the next morning, there's no wireless connections anywhere. It's like there's no wireless network adapter available. I have retried the uninstall-reinstall...

Multiple USB Ports.
Hello All! My machine runs XP but has only two USB 2.0 ports. Some of the hardware that I have will function quite well on one of the two USB 1.0 ports but really, I think I need about 6 USB ports. There seem to be two possibilities: install two more USB 2.0 cards or use a plug-in multiport attachment. That last requires installation of a driver. I wonder what would be the best way to go? I'd be grateful for advice. -- James Silverton Potomac, Maryland Email, with obvious alterations: not.jim.silverton.at.verizon.not James Silverton wrote: > Hello All...

Serial Letter- Connection with Excel database
Hi there, i want to print about 200 adresses on etiquettes. those are in an excelfile. the probl. is that I have on data on a whole page. What can i do, that every etiquette is filled with a different data? Thanks forward Vicky -- Vic1978 ------------------------------------------------------------------------ Vic1978's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=28708 View this thread: http://www.excelforum.com/showthread.php?threadid=492986 Do you mean envelopes? If you do, you may want to use MSWord's mailmerge for the printing of the envelop...

Connect to the internet wizard fails sbs 2003
Hi, I hae taken oer another SBS server. When running the connect to the internet wizard it fails on the firewall configuration. I have had to go into IIS and change access permissions on the exchange/remote sites in order to get these working. It also fails to create the new certificate matching the external host name leaving the one in the place which is completely wrong. How can I troubleshoot this issue. Thanks Simon Hi Simon: the CEICW creates a log file when it runs, but it is appended to each time you run the wiz so it gets pretty cumbersome. I would find that file a...

Firewall/Ports FE to BE
Have the KB270836 regarding Port Mappings; we have installed a new Firewall Applicance and are Now having Issues from the Front End to the BackEnd. Need to know specifically what ports need to be open from the FE Server to the BE Server; and what ports need to be Open from the FE Server to the DC's. It seems that we are now having authentication issues. Thanks Randy Configuring an Intranet Firewall (FE-BE topology guide) http://www.microsoft.com/technet/prodtechnol/exchange/guides/E2k3FrontBack/f9733398-a21e-4b40-8601-cfb452da82ad.mspx -- Bharat Suneja MCSE, MCT www.zenprise.com ...