CAsyncSocket connect problem #2

Okay,

Here is my network setup:


My pc NIC IP is 10.128.98.121
My remote pc IP is 10.128.98.100


Now I wrote the CAsyncSocket class that will call
Connect("10.128.98.100",
1234).
By right, it should return error trying to establish connection to the
remote pc which is on the same network (as I can PING it) but the
function returns me 0 which means it fails. Why is that?


Am I missing something? 


Mike

0
9/8/2006 2:43:55 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
508 Views

Similar Articles

[PageSpeed] 3

cybernerdsx2 wrote:
> Okay,
> 
> Here is my network setup:
> 
> 
> My pc NIC IP is 10.128.98.121
> My remote pc IP is 10.128.98.100
> 
> 
> Now I wrote the CAsyncSocket class that will call
> Connect("10.128.98.100",
> 1234).
> By right, it should return error trying to establish connection to the
> remote pc which is on the same network (as I can PING it) but the
> function returns me 0 which means it fails. Why is that?
> 
> 
> Am I missing something? 
> 
> 
> Mike
> 

You should GetLastError to find out the reason for the error return. 
Normally, you will get WSAEWOULDBLOCK.  That simply means the operation 
is continuing in the background and your override of OnConnect will be 
called when the real result becomes available.

That's why it's called an 'async' socket.  Instead of blocking your 
program for many seconds it calls you back later.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
9/8/2006 3:26:02 AM
Ok, I overridded the OnConnect() function now but I still get the
errorcode as 0 for ip addresses that I can't ping from my pc
(10.128.98.121).

For example,

myAsync->Connect( "10.1.1.60", 9292 );

This will return 0.


Scott McPhillips [MVP] wrote:
> cybernerdsx2 wrote:
> > Okay,
> >
> > Here is my network setup:
> >
> >
> > My pc NIC IP is 10.128.98.121
> > My remote pc IP is 10.128.98.100
> >
> >
> > Now I wrote the CAsyncSocket class that will call
> > Connect("10.128.98.100",
> > 1234).
> > By right, it should return error trying to establish connection to the
> > remote pc which is on the same network (as I can PING it) but the
> > function returns me 0 which means it fails. Why is that?
> >
> >
> > Am I missing something?
> >
> >
> > Mike
> >
>
> You should GetLastError to find out the reason for the error return.
> Normally, you will get WSAEWOULDBLOCK.  That simply means the operation
> is continuing in the background and your override of OnConnect will be
> called when the real result becomes available.
>
> That's why it's called an 'async' socket.  Instead of blocking your
> program for many seconds it calls you back later.
> 
> -- 
> Scott McPhillips [VC++ MVP]

0
9/8/2006 4:58:16 AM
cybernerdsx2 wrote:
> Ok, I overridded the OnConnect() function now but I still get the
> errorcode as 0 for ip addresses that I can't ping from my pc
> (10.128.98.121).
> 
> For example,
> 
> myAsync->Connect( "10.1.1.60", 9292 );
> 
> This will return 0.

That is normal, as already explained in my previous answer.  Is there 
something about it you don't understand?  When it returns 0 do you call 
GetLastError()?

-- 
Scott McPhillips [VC++ MVP]

0
Scott
9/8/2006 1:24:07 PM
I think he's still thinking that Connect will work immediately.  He's missed the whole
idea of asynchronous sockets, which is that "Connect" means "please start a connection and
get back to me later", and it is *extremely* unlikely that the operation will succeed, and
so 0 is what is expected (and of course, if there were something else wrong, then the
error code would be something other than WSAEWOULDBLOCK, which would mean he has to fix
whatever is wrong).  And somehow he thought that adding OnConnect is going to change the
return code from Connect, which of course it won't.  The connect is, for all practical
purposes, ALWAYS going to fail, every single time, because it is an asynchronous connect.

I'm also curious about the problem relating to an inability to ping.  Since 10.xxx.xxx.xxx
is a private subnet IP address, a ping on the local subnet should work.   If the machine
isn't on the local subnet, then a connect will probably fail, too, but the error code
would not be WSAEWOULDBLOCK.
				joe
On Fri, 08 Sep 2006 09:24:07 -0400, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
wrote:

>cybernerdsx2 wrote:
>> Ok, I overridded the OnConnect() function now but I still get the
>> errorcode as 0 for ip addresses that I can't ping from my pc
>> (10.128.98.121).
>> 
>> For example,
>> 
>> myAsync->Connect( "10.1.1.60", 9292 );
>> 
>> This will return 0.
>
>That is normal, as already explained in my previous answer.  Is there 
>something about it you don't understand?  When it returns 0 do you call 
>GetLastError()?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
9/8/2006 3:10:51 PM
Reply:

Similar Artilces:

exchange 2003 and DC #2
hi, exchange 2003 enterprise edition, in a 2000 AD environment. There are 4 DCs, DC1, DC2, DC3 and DC4. All except DC4 are GC servers. DC1 holds all the FSMO roles in the AD. When DC1 goes down for some reason, I see problems happening with the exchange server even if the other DCs are up and running. Shouldn't exchange continue to work (sending emails and receiving emails, at least) as long as any DC which is a GC is up? The error events I see in exchange's server's application event log (when DC1 is down) are: LDAP Bind was unsuccessful on directory DC1.company.net for...

formating dates #2
i am new here so forgive me if this is an old or stupid question. i have excel 2000 and i am trying to enter in dates for a check book register. i set the format for the cell to date to xx/xx/xx . when i enter in a date of 010203 for jan 2nd 2003 i get a date of 01/14/55 i can not figure this out. i am sure i am doing something wrong since i do not use this that often. please any help is greatly appreciated thank you mike c Mike, You need to enter the date as 01/02/03, so that Excel will then recognise it as a date. Otherwise it treats it as a serial number, and calculates the date as t...

Problem importing contacts from outlook express
I recently installed Outlook 2000. During installation it asked me if i wanted to import contacts from outlook express. My express has several identities: personal, business and my girlfriends. The "import" took the contacts from my personal account and then it deleted the other two in their entirety (from express). I now have none of my business contacts and I am absolutely furious. Any suggestions? have you tried setting up Outlook profiles to match your other two identities, and running the import again? I'm not sure it would work, but it might be worth a shot......

Irregular Date Problem
The following problem only occurs in certain tabs in only one of my spreadsheets. When I enter a date -any date- it returns "1/0/1900." I have entered various dates and formatted the cells as numbers, and the cells return different numbers for the differing dates; however, when I reformat them as "dates" they all return "1/0/1900" or some function of this date whether it be "1/1900" or "1/0." I can enter a date into another tab -- in which the dates are working -- then copy and paste the date into a tab -- in which the dates aren't...

Routing Group Connections between Administrative Groups?
I have a question regarding the subject... since I don't have an option to try this for myself: When multiple routing groups and routing group connectors between them are used... how does one establish a rgc between routing groups that are handeled in separate administrative groups? Let's say that an administrator has full administrative permissions only within his given administrative group. If there are no two-way connectors established between the routing groups in other administrative groups the communication doesn't work, right? So am I right in concluding that the administra...

Converting minutes to seconds #2
How do i convert minutes to seconds? 4 Minutes 11 seconds = 251 seconds How do i get excel to do it for me? :confused: Thanks Jame -- smith.james ----------------------------------------------------------------------- smith.james0's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1623 View this thread: http://www.excelforum.com/showthread.php?threadid=27641 How is the data presented? If it always comes as 4 Minutes 11 seconds then you could do this: (supposing A1 contains "4 Minutes 11 seconds ") then in B1 = mid(a1,1,2)*60 + mid(a1,11,2) this wi...

Slow Internet Connection, HELP
Hey Vista Home, I guess it's an Acer Laptop, (don't have the computer in front of me now) My girlfriend has a got a new ISP. Originally she uses a cable to connect to the switch/modem, But now another ISP have installed a new modem/switch in her house. the cable guy left the modem without connecting any cat5 cables to the modem/switch so the computer where offline for a while until I plugged in the cable to the modem... The cable isn't that nessecery as the modem is sending wireless also.... but when using cable connection the trasfer rate (incoming) is 7kb/s, ...

When comparing +2 to +2
Hi guys, I have a sheet form making a deviation table for a magnetic compass. Column D holds single digit values of deviation. I need not only negative numbers to have a sign, but also the positive ones, like +2. So I have formatted those cells as custom +0;-0;0 wich does the job fine. Furthe into the sheet I have a large grid of 19*36 cells where I want a little x in all cells that are equal to the ones in the D column. It works fine with negative numbers, and with zeros. But not with the positive ones. The formula is simply =IF($D5=S$2;"x";"") and onwards. In this pa...

Radar Chart #2
I am making a Radar Chart that can change as the data changes in the source cells. The problem occurs when some rows change and do not have data in them. I dont want these "blank" cells to be displayed as a blank points on the Radar chart but can't delete the rows as these may be required in the next data set. When the cells are blank they are hidden but the radar graph still includes the hidden and balnk cell. Could you offer any advise as to how to get the radar graph to ignore blank rows. Thanks in advance, Angus Angus - You need to use dynamic named ranges that...

Internet connection not seen during activation
I'm trying to activate my Money Plux Deluxe (2008?), but after entering the key and clicking the 'activate' button, I get the following error dialog box: Money could not be activated. Please confirm your product key and check to be sure that your computer is connected to the Internet. I double checked the key, and it appears to be correct. My web browser appears to be getting pages correctly...I have a wired and wireless connections on this computer, and the Windows Vista firewall is on. Do I need to open up some special port for MS Money to talk to the mothership? ...

CAsyncSocket
My main thread creates a CAsyncSocket derived class and tries to connect to the server by calling the Connect method. Unfortunately, since CAsyncSocket is non-blocking, the OnConnect notification arrives as a message to the main window. But, I cannot continue processing until a successful connection has been established and I don't want to create a worker thread to initialize the socket. Is there any way I can process windows messages and wait until the OnConnect function returns with the connection status? "Rohit" <Rohit@discussions.microsoft.com> wrote in...

Payment problem !
I have 2 stores running RMS 2.0 I was porcessing a payment at one store and POS appears to have crashed after I had tried to process a $600 cash payment. The reciept printed, I can see it in the RMS SO manager reporting, I can see it in the Journal. However, I can not see the payment in Customer properties at that Store. The account is correct in RMS HQ. How can I correct this ? FYI, this fixed it self. HQ must update SO for missing info. The payment now shows up everywhere/ "John M" wrote: > I have 2 stores running RMS 2.0 > > I was porcessing a payment at one st...

Help with writting macro #2
Hi I have a list of code eg. AH100, AH200 etc. in a column on a worksheet with a field name 'StaffIDNo'. I would like to create a workbook for each code, with the code in a specified cell A1 e.g AH100, and the workbooks are saved, 'code' Time allocation schedule.xls e.g AH100 Time allocation schedule.xls in the same specified folder. Thanks. ...

Problems connecting with clients
I've had to do a manual install on clients and I still can't get the server (DPM2010)to communicate with clients, and I think the problem is on the server (Windows 2008R2x64). The client error log for DPMRA says "host is unreachable" but the server firewall config shows all the DPM apps allowed through for the domain. Any pointers? Here are some guidelines on how to debug it, I am assuming that DPM and PSes are in a single domain(or having trust to each other's domain) and you have successfully attached the agent on DPM. 1. One quick way to isolat...

Microsoft Money 2004 Small Business #2
Can you print out 1099 forms for vendors with Microsoft Money 2004 Small Business and am i able to keep track or customer sales and appointments. I have never used this before. I have been using Quickbooks Is money 2004 business a uk edition. I am looking for 2004 personal & business are they the same thing? thanks lucky star No, you cannot print 1099s nor keep sales appointments. But you can keep track of customer sales (sales your company makes). MS Money Sm business is a very capable personal finance manager with some - not all - small business functionality weaved in. If...

List Problem
Fellow Excellians, I need a little help Picture my screen I have 16 teams and about 12 to 15 people per team Cell C1 TO C100 Contains Various Team Names Cell D1 to D200 Contains peoples Names In Cell A1 Contains "Team Name" in Cell A2 i want to select a person from the list i have created in C1 & C2 but it needs to filter out only the people that play for that team selected in A1 Anyone Got any idea's Thanking so much in advance Steve ...

ACT! data migration problems
We are using Scribe and their ACT! template to migrate data into MSCRM. We are doing something wrong, because each contact record is creating a new account record, instead of the contacts from the same company being added to a single account record. I would like to be in contact with someone who has done this migration successfully in order to find out what we are doing wrong. If you can give any help, please post some contact information or email me at "rick at cimbrian.com". Thanks, -Rick Hi Rick, Jeff Loucks 888-474-2237 MVP "Rick M" <RickM@discussions....

Thorny problem graphing XAxis dates
Sorry, I'm not really sure how to state this question succinctly. I have data in an MSAccess Db re medications and the time\date and amounts taken. Mads are entered only in the db on days when they are taken yet I need the graph to show ALL days including days not taken. That is, days when the amount is inferred to be zero because no data appears for that day. Sorry, that's probably as clear as mud. Currently, I'm using VBA code to select the data, build a spreadsheet and then build a graph from the spreadsheet I built. The problem is that it (obviously) graphs only the days meds...

Upgrading from CRM 1.2 to 3.0
I am upgrading from Microsoft CRM 1.2 to 3.0. During the installation process, I get the following two warnings: - Verify Domain User account SPN for the Microsoft CRM ASP.NET Application Pool account. - Setup was unable to verify that the "Trust for Delegation" property is enabled for the computer object. Any idea on what these warnings mean and how to address them? Jeff I am doing a new install of CRM 3.0 and have the exact same errors. Does anyone know what to do to fix this. I have delegated the computer account in AD, but not sure what to do to fix the ASP.NET pool ac...

Problem opening Word
I can open Word documents in Word but not out of Windows Explorer. Any help? -- JRB See http://word.mvps.org/faqs/apperrors/reregisterword.htm. -- Stefan Blom Microsoft Word MVP "tooltimejack" wrote: > I can open Word documents in Word but not out of Windows Explorer. Any help? > -- > JRB ...

Entourage 2008 Web Services Edition cannot connect to Exchange Server 2007
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: Exchange I have been using Entourage 2008 to connect to our Exchange server since it's release (part of Office 2008) and I have recently followed the instructions to update it to the Web Services Edition. I am now unable to connect to my Exchange account with this version but as soon as I re-install the 'normal' version of Entourage 2008 everything works. <br><br>Is there something I need to enable on the Exchange 2007 server to allow the Web Services Edition to connect? ...

Connecting mac clients
Hi I have no prior experience with macs and unfortunately this new client has some macs that need connecting to the new sbs 2003 standard R2 dell server. Could someone please guide me to some easy steps to connect macs to sbs as client to access exchange emails (via apple mail or some such) and internet? Many Thanks Regards These links should help: Connecting a Macintosh running Mac OS 10.5 to an SBS 2003 Server http://simultaneouspancakes.com/Lessons/2007/10/28/connecting-a-macintosh-running-mac-os-105-to-an-sbs-2003-server/ SBS-Mac links (several pages) http://s...

Business Portal #2
I've got Business Portal up and running, everything seems to work fine except for the advanced role customer. It let's me link a login to the customer account but when I log in all I get is the home page with no data. No pages for customer info (ie invoices...etc). Any ideas? Thanks Matt GP 7.5 Busines Portal 1.0 If I recall there is a newer version of BP you should install either 1.5 or 2.0 would try that first >-----Original Message----- >I've got Business Portal up and running, everything seems >to work fine except for the advanced role customer. It >...

CAsyncSocket::Receive and CAsyncSocket's threading...
Hi again, 1. Is CAsyncSocket::Receive a blocking function? 2. How is the IO Strategy for MFC's CAsyncSocket? 1 thread to do all stuff? Thanks again. pixelmana wrote: > Hi again, > 1. Is CAsyncSocket::Receive a blocking function? > 2. How is the IO Strategy for MFC's CAsyncSocket? 1 thread to do all stuff? > Thanks again. 1. No. "Async" means non-blocking. 2. CAsyncSocket sends you notifiction messages via the Windows message queue. These messages are just like button and mouse messages. CAsyncSocket turns them into calls to your derived class virtual fu...

Money has encountered a problem
I just looked at this site and see that I am not the only one with this problem that started today. I got same error after entering about 3 months of credit card data then pressing the home button after I balanced. God I hope it's not lost. Do these updates occur automatically? If so how do you turn them off or get a warning? I guess calling MS Support is a waste of time since the version of MS 2004 came preinstalled on my computer. So what's the best way to get some help? Thanks Ron In microsoft.public.money, Ron wrote: >I just looked at this site and see that I am not...