Why does CSocket->Create() hang forever?

The problem:

A class derived from CSocket is instantiated.
The class's "Create()" function is called.
The "Create()" function never returns -- hanging MyApp.

This only occurs on a small percentage of the PC's on which MyApp is 
installed. I know the problem occurs on XP PC's, I don't know if occurs on 
other kinds of PC's.  It has occurred on two or more laptops, as well as at 
least one desktop.  

The Visual Studio solution is in Visual Studio .NET 2003.  The problem also 
occurred in the Visual Studio 6 version of MyApp.  The solution code is 
unmanaged C++ (with some C).  The solution is built on an XP PC.  I have not 
been able to replicate this on a development PC in order to debug the 
"Create()" function.  Since the "Create()" function never returns, it is not 
possible to catch an error code from the function.

When the problem occurs, the customer can open a DOS command window and 
successfully ping devices located on the LAN.

See example code below.

Is this a known problem?  Is there a workaround?

Thanks,
Dave

////////////////////////////////////////////////////////////////////
Example code:

m_pSockServer=new CListeningSocket;
if(!m_pSockServer->Create(700)) <--- "Create()" hangs, never returns.

The class declaration for CListeningSocket is the following:

class CListeningSocket : public CSocket
{
    DECLARE_DYNAMIC(CListeningSocket);
    private:
    CListeningSocket(const CListeningSocket& rSrc); 
    void operator=(const CListeningSocket& rSrc); 
 
    // Construction
    public:
    CListeningSocket();
 
    // Overridable callbacks
    protected:
    virtual void OnAccept(int nErrorCode);

    // Implementation
    public:
    virtual ~CListeningSocket();
};


The class implementation for CListeningSocket is the following:

#include "stdafx.h"
#include "server.h"
#include "lstnsock.h"
extern CServerApp theApp;

CListeningSocket::CListeningSocket()
{
}

/////////////////////////////////////////////////////////////////////////////
// CListeningSocket Overridable callbacks
 
void CListeningSocket::OnAccept(int nErrorCode)
{
CSocket::OnAccept(nErrorCode);
/* do accept here */
theApp.DoAccept();
}

/////////////////////////////////////////////////////////////////////////////
// CSocket Implementation
CListeningSocket::~CListeningSocket()
{
}
IMPLEMENT_DYNAMIC(CListeningSocket, CSocket)

0
babel1 (2)
11/4/2005 5:15:20 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
801 Views

Similar Articles

[PageSpeed] 21

Hi Dave,

>This only occurs on a small percentage of the PC's on which
>MyApp is installed. I know the problem occurs on XP PC's, 
>I don't know if occurs on other kinds of PC's.  It has occurred 
>on two or more laptops, as well as at least one desktop.  

Would you please tell me have those PCs(which have the problem) all 
installed the Windows XP SP2?

Based on my experience, the new firewall and security settings in XP SP2 
will block some application's network communication, so I need to confirm 
does this problem only occurs in Windows XP SP2(or Windows 2003 SP1) 
machines, it may not be a programming issue.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ��C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn 

This posting is provided "AS IS" with no warranties, and confers no rights.

0
v-garych (605)
11/5/2005 9:43:49 AM
Gary,

The PC's in which the problem occurs do not all have SP2.  Some are at SP1.

Note, the sample code in the original problem posting shows that the 
"Create(700)" function is being called with a port number of "700".  I did 
not include this detail in the problem overview.  Could this be related to 
the problem?  If so, what port number should I use?

I could not find any documentation describing which port number to use.  The 
code in which the problem is occurring is code that I inherited with the 
project, I have no idea why port "700" was originally chosen.

Any ideas on how to resolve this?

Thanks,
Dave

""Gary Chang[MSFT]"" wrote:

> Hi Dave,
> 
> >This only occurs on a small percentage of the PC's on which
> >MyApp is installed. I know the problem occurs on XP PC's, 
> >I don't know if occurs on other kinds of PC's.  It has occurred 
> >on two or more laptops, as well as at least one desktop.  
> 
> Would you please tell me have those PCs(which have the problem) all 
> installed the Windows XP SP2?
> 
> Based on my experience, the new firewall and security settings in XP SP2 
> will block some application's network communication, so I need to confirm 
> does this problem only occurs in Windows XP SP2(or Windows 2003 SP1) 
> machines, it may not be a programming issue.
> 
> 
> Thanks for your understanding!
> 
> Best regards,
> 
> Gary Chang
> Microsoft Community Support
> --------------------
> Get Secure! ¡§C www.microsoft.com/security
> Register to Access MSDN Managed Newsgroups!
> http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
> &SD=msdn 
> 
> This posting is provided "AS IS" with no warranties, and confers no rights.
> 
> 
0
babel1 (2)
11/8/2005 12:39:05 AM
Dave Leach wrote:
> Gary,
> 
> The PC's in which the problem occurs do not all have SP2.  Some are at SP1.
> 
> Note, the sample code in the original problem posting shows that the 
> "Create(700)" function is being called with a port number of "700".  I did 
> not include this detail in the problem overview.  Could this be related to 
> the problem?  If so, what port number should I use?
> 
> I could not find any documentation describing which port number to use.  The 
> code in which the problem is occurring is code that I inherited with the 
> project, I have no idea why port "700" was originally chosen.
> 
> Any ideas on how to resolve this?
> 
> Thanks,
> Dave

If the problem is repeatable you could certainly experiment with a 
different port number.  But that seems unlikely to be the problem: If 
the port is already occupied you should expect to receive a return error 
code from Create.  Port numbers below 1024 are reserved for well known 
protocols.  You should use anything from 1K to 64K-1.  (This is not 
documented by Microsoft but by the Internet authorities.)

You can probably get more information about the problem (if you can make 
it happen) by running a debug build in the debugger, on a machine that 
has the MFC source code installed.  That will let you break into the 
hung program and see at a lower level where it hung.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
11/8/2005 2:11:40 AM
Dave Leach wrote:
> I could not find any documentation describing which port number to use.  The
> code in which the problem is occurring is code that I inherited with the
> project, I have no idea why port "700" was originally chosen.
>
> Any ideas on how to resolve this?

Well, the CSocket design of synchronous network communication is bugged
from the get go. You may have just ran into one of the many little
nifties that doesn't quite work as intended.

Are you using CArchive and CSocketFile in this set up also?

0
darsant (187)
11/8/2005 6:30:48 AM
Reply:

Similar Artilces:

Problem creating first public folder #2
I have SBS 2003 with Exchange 2003 installed. I have problem when trying to create the first public folder. I get an error message with the ID n. ID no: 80040E19 Can anyone help me with that ? Thanks ...

Creating Shortcut
Hi everyone, Can you please help me how I can creat shortcut for keyboard? Thanks in advance. -- eylul ------------------------------------------------------------------------ eylul's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=13025 View this thread: http://www.excelforum.com/showthread.php?threadid=378010 Do you have a macro that you need a shortcut key? If yes, Tools|macro|macros|Select your macro and click the option button There's a spot where you can specify the shortcut key. If you're looking for the equivalent to MSWord's: Tools|cu...

Entourage 2001 hangs when try to print
I'm running Entourage 2001 9.0.2 (4011) on Mac OS 9.2.2 on a PowerComputing clone that has a G4 processor. When I try to print certain received messages, the computer hangs before the Print dialog box shows, and I have to reboot. Thanks for any help, Ken Hi It sounds like those certain messages might be putting the memory requirement for Entourage over the setting that it has allotted in Finder. Try raising the preferred setting in FInder using GetInfo. Add at least 10 meg (10000) and see if that cures the ill. -Jim Gordon Mac MVP All responses should be made to this newsgroup with...

Question about creating a template
I am trying to create a template for my boss that is used to track Claim Reviews for the health care industry. My boss is very computer challenged, so I need a form that she can type answers in and it transfers to a spreadsheet. It has to be protected, she is one to push the red button to see what it may do, even after telling her not to push the button. Any suggestions for getting started? I wanted something similar. I would make a form for them to fill it out and then make it "read only" so she has to do an F12 and save-as every time. how I do I make the form? "cho@noh...

Lost options in Explorer like "create new word document"
Hello Some users have lost options in the "mouse right-click" in the Windows explorer as "Create New Word Document". I have tried some solutions as this one : http://www.winhelponline.com/blog/add-word-97-2003-entry-to-the-new-menu-after-installing-word-2007/ Adding Word 97 ? 2003 entry to the New menu 1. Start Regedit.exe 2. Navigate to the following location: HKEY_CLASSES_ROOT\.doc\Word.Document.8\ShellNew 3. From the Edit menu, click New, String value. 4. Name the new String value as Nullfile 5. Exit the Registry Editor. But the option does not appear...

CSocket
Hi, I have created an application which is using CSocket for creating a client socket. This application is working fine when MFC is dynamically linked with the same, The same application crashes at Create when i am making a static build. CSocket *socket; socket = new CSocket(); socket->Create(); Can any body please tell me the reason behind this. Thanks, Ritu ...

Creating a webpage
I have Publisher 2003 for XP. How do I center pictures on my pages that are linked from a photo sharing site that I use? Thanks, Carl Iced Tea wrote: > I have Publisher 2003 for XP. > > How do I center pictures on my pages that are linked from a photo > sharing site that I use? > > Thanks, > Carl ======================================== Try posting your question in the following newsgroup: "Publisher Web Design" http://tinyurl.com/5l7mb5 or... http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.publis...

Problem with CSocket
Hi all. I wrote an MFC application to make an HTTP file transfer between a client and a server. The application receives as input the list of servers to call (in this case, servers are remote devices with an embedded web server), and one by one it sends the file and closes the connection. The sequence of the operations made is this: 1) Dial-up call to device X 2) Open socket on port 80 3) HTTP POST of the file to the device 4) Wait for the response, and analysis to understand if the transfer has gone well or not 5) Open a new socket (after the response, the old socket is closed) 6) HTTP ...

Using CSockets
Hi I'm new with the sockets..Most of the post about CSocket i've seen on the newsgroup discourage the use of CSocket and recommend to use CASyncSocket. Could any one tell me the reason that why is CSocket being discouraged so much..whats wrong with it. I wanted to know coz i'm myself using it in my code and i dont have mch experience with sockets so as to know the problems inherent in it.. Thanx and Regards Usman Jamil Read the following threads on this subject. http://tinyurl.com/gjl9 -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- &quo...

Creating collection woes
I'm using the code from Chapter 7 of ADH 2002 - the stuff that goes with the MultiPik class. The form has two listboxes, which can be filled in several different ways, and I am trying to use two collections. I can populate the lstAvailable just fine... FWIW, here's the code... Here's the code I'm using in the form: Private Sub Form_Open(Cancel As Integer) ' Four steps to using Multipik: ' 1. Instantiate the object ' 2. Set up the RowSourceType for the list boxes. ' If you did this at design time, you needn't ' ...

creating sorted copy of table on second sheet
Hello all, table on sheet 1 consists of (say) a row with names and a row with room numbers and is sorted by name. (First row is header and not included in sorting.) I want to create a copy of this table on a second sheet containing the same data sorted by room number which automatically re-sorts when the data in the first table is changed. I could think of a matrix function but could not find any. Any idea? -- email me: change "nospam" to "w.hennings" Dipl.-Ing.(=M.Sc.Eng.) Wilfried Hennings c./o. Forschungszentrum (Research Center) Juelich GmbH, MUT <http://www.fz-juel...

what software that will create feathered brochures?
Will Microsoft Publisher 2003 Full create a feathered brochure? What is a feathered brochure? -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Carolyn Kane" <Carolyn Kane@discussions.microsoft.com> wrote in message news:4EF517BD-45F5-4614-8E91-81C01771B646@microsoft.com... > Will Microsoft Publisher 2003 Full create a feathered brochure? A 'feathered brochure' is a brochure that fades towards the edges. "Mary Sauer" <gsauer@mycolumbus.rr.com> wrote in message news:%23Uj4weRtFHA.3908@tk...

Problem creating full text index
I seem to be unable to create a full text index of either my public or private store. When I try to creat the index I get the error; The directory name is invalid. Facility: MSSearch.Admin.1 ID no: 8007010b Exchange system Manager This seems to be happening for both the public and private stores. The directory does exist. I have looked over the permissions and tried to compare to known working servers and I haven't moticed any obvious differences. Any ideas? Did you follow this article: http://support.microsoft.com/kb/822932/en-us Nue "Jonathan Huber" <JonathanHu...

CImage::Create()
Hi. I'm trying to read .jpg files with a test program in VC7. It was modified from the MS SimpleImage sample.It works when I repeatedly use CImage::Load() to load the next .jpg and CImage::Destroy() before repeating the Load() in a loop. I now wish to use CImage::Create() to set up an empty bitmap at each iteration and then copy bitmaps into it with CImage::StretchBlt(). This works for the first time but stops with this ASSERT ATLASSERT( m_hDC == NULL ); in inline HBITMAP CImage::Detach() . I don't understand why the bitmap handle is non-zero after the Destroy(). Any ideas? TIA R...

Creating a populated field
Im building a form and in the subform I want a "description" field to be populated when I enter a "Part Number" in the field before it. I have a separate table listing part numbers and their descriptions. It's been a while and my memory is a bit rusty. Im working in Access 2000. Thanx for your help Tom On Nov 29, 11:45 am, Tom <T...@discussions.microsoft.com> wrote: > Im building a form and in the subform I want a "description" field to be > populated when I enter a "Part Number" in the field before it. I have a > separate tab...

Drag n drop FoxPro table to create XSD file
Hi All, Getting error message: "The following unexpected error has occurred: There were errors dropping "acctrecv" onto the designer. The XML Schema could not be interpreted from this object." when I am trying to create Strongly Typed Dataset from Visual FoxPro table. Does anybody know how to fix a problem? I only found to use CursorToXML vfp command to go around a problem. Is it possible to fix a problem in Visual Studio? Thanks, Alex ...

Resources on CSocket
Are there any good resources on socket/network programming? Thanks in advance, Lem Lem wrote: > Are there any good resources on socket/network programming? > > Thanks in advance, > Lem > > http://tangentsoft.net/wskfaq/ For many reasons, some of which are explained in this FAQ, don't use CSocket. It is harmfull to GUI programs and doesn't work in non-GUI programs. But CAsyncSocket and/or the winsock API are well worth learning. -- Scott McPhillips [VC++ MVP] Depends on what you want to do. As Scott points out, you want to avoid CSocket entirely. But ...

Creating new table columns and maintaining joins in another query
Hi, I have a table with alot of account information. However, to report on certain accounts, I have to manipulate a few of the column data and create a new column with the correct information. Once I have this new column, I do another query and get the information that I need out of that new column. The problem is when I'm querying from that new column, I'm join'ing that information to another column of information and it works the way I want it to work. But when I get more data, I have to run the original script that manipulates the data and creates a new column, agai...

Web Services Create SOP
I am using the web service to create the SOP, I am able to create a SOP without any detail line, but whenever I add any details line, I got SOAP error, and then I check the exception console, I got this message "There was an error generating the XML document.". I have no idea of what does that mean, I am thinking I am missing something need to be assigned in detail line, but I cannot find any, I am sure there must be some trick, like when assigning the document date of the SOP header, it has to be Date only (without time), otherwise, I will get this error message "There i...

creating a bleed and printing it to pdf.
Hey Guys and Gals, I am trying to create a page that is the size of an A4 with a 3mm bleed all around, and I would like to see crop marks. What I have done is.... Started with an A4, and than shrunk the margins to 0 on all sides. Than under printing, and advanced settings I clicked on bleeds, show bleeds, crop marks, and used Adobe PDF to print. It didnt work out. I dont know why. Anybody have any other ideas as per how to do this? Thanks. Help here Create a bleed for your publication http://office.microsoft.com/en-gb/publisher/HP101208091033.aspx?pid=CH101778921033 Tips for preparin...

how do you create an eshot
is there a process I need to know for embedding an image in an email so I can design an eshot message? "nos27ila" wrote in message news:643C7A36-2CF6-4150-980E-0377AC9984D8@microsoft.com... > is there a process I need to know for embedding an image in an email > so I can > design an eshot message? e-shot: Email Marketing Softwaree-shot is a leading tool for fulfilling and managing e-messages ie Email Marketing Campaigns, Newsletters, Bulletins, e-zines, Promotions, e-Billing, etc. www.e-shot.net/ You thought this was a pro-spam newsgroup? You'll have to ...

Creating Invoice with filtered data
I have a template that is uses three sheets of data to calculate costs and then the fourth sheet is the invoice. I would like the invoice to automatically enter the line item costs for which there is a charge. For example, there are four item charges that are standard for every invoice but these come after the primary charges. The list of primary charges may consist of one line item or ten. I have been using a basic formula IF(ISTEXT(Quote!$B4),Quote!$B4,"") but then I have to manually enter all of the standard charges. I would like to enter a formula that will see that there ar...

Creating new screens
Has anyone created a new Activity page which is called when a user clicks on an activity on the list page? Is this possible to not call the standard page and replace it with the new page created? =20 If so can you give me some pointers where best to look. =20 Also when creating new pages is there any templates available to get the same look and feel? =20 All advice very much appreciated. this should help you http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmbscrm/html/mbs_crmappdup.asp you use a template file to give your customized pages the same look and feel of the sta...

Can you create a transparent text box in Microsoft Publisher
Can you create a transparent text box in Microsoft Publisher heater <heater@discussions.microsoft.com> was very recently heard to utter: > Can you create a transparent text box in Microsoft Publisher Yes. Ctrl+T. You cannot make the text partially transparent. The text box can only be semitransparent in Publisher 2002 or 2003, and this does not always print correctly. -- Ed Bennett - MVP Microsoft Publisher Thanks Ed, I tried that & it not quite what Im after. In microsoft word you can make the fill of a text box semi transparent. This is good for instance if you hav...

Create Shortcut
OK, I googled and found that there are at least three methods of creating a shortcut that I can understand. The fourth I am not to sure about. I want to create a shortcut in the SendTo folder for my app. Command$ will have filenames to work with. So what are the pros and cons of 2 and 3. I already read the cons of 1. And 4 may be beyond me without sample code to look through. 1) use fCreateShellLink (uses vb6stkit.dll). 2) use SHAddToRecentDocs to create the shortcut in the RECENT folder then FileCopy to the desired folder. 3) use WSH to create the shortcut in the app fol...