Re: How do I define the Source port value when creating a socket

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Thanks again for your feedback it is extremely helpfull.
I have the crash log from the event viewer listed below. But before that
may I ask a dumb question. I am using the WSA() calls, are they the MFC
wrappers you mentioned? Or are there other socket calls in MFC. If there
are yet others should I be using the WSAsocket() vs the plain socket() calls.

To follow sample code in MSDN, I used the socket() on the listening socket
and left WSASocket() call on the sending socket when I create the sockets.

Here is the crash event log in case you can interpert it and let me know
what went wrong. ( it was MFC42u.dll ) . I'm a telephony programmer moving
onto the IP world. Any insight would be appreciated

Event Type: Error
Event Source: Application Error
Event Category: (100)
Event ID: 1000
Date: 10/7/2005
Time: 2:53:53 PM
User: N/A
Computer: CRCMNIVR
Description:
Faulting application SMSrvr.exe, version 3.1.0.6, faulting module
mfc42u.dll, version 6.0.8447.0, fault address 0x00051a89.

For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
Data:
0000: 41 70 70 6c 69 63 61 74 Applicat
0008: 69 6f 6e 20 46 61 69 6c ion Fail
0010: 75 72 65 20 20 53 4d 53 ure SMS
0018: 72 76 72 2e 65 78 65 20 rvr.exe
0020: 33 2e 31 2e 30 2e 36 20 3.1.0.6
0028: 69 6e 20 6d 66 63 34 32 in mfc42
0030: 75 2e 64 6c 6c 20 36 2e u.dll 6.
0038: 30 2e 38 34 34 37 2e 30 0.8447.0
0040: 20 61 74 20 6f 66 66 73 at offs
0048: 65 74 20 30 30 30 35 31 et 00051
0050: 61 38 39 a89

Thanks again for your help on this.


--
Thanks
Morris


"Eugene Gershnik" wrote:

> Morris Neuman wrote:
> > Thanks so much for your advice. I got it going with your help.
> > But if I may ask, I tried to just do the Bind() on the same socket I
> > do connect() on. but that caused the system to crash with error in
> > some mfcu.dll. I had to make a seperate socket and use that to
> > listen on and that worked.
> >
> > Any thoughts on that? that a best practice on that.
>
> When you have a crash you need to record the location of it, call stack and
> everything else that is reported by your debugger. Otherwise asking about a
> crash without such info is like asking a doctor for the diagnosis based only
> on "I have a headache" complaint ;-)
>
> bind() and connect() on the same socket should work fine but it is usually a
> bad idea. This group contains plenty of discussions on this issue so you
> might want to google them out.
>
> Since you mention mfcu.dll I assume that your application uses MFC. If so,
> another advice would be to stay away from MFC sockets wrappers and use plain
> Winsock API instead.
>
>
> --
> Eugene
> http://www.gershnik.com
>
>
>
.



Relevant Pages

  • Re: Threaded app using sockets closes
    ... You can use DEBUGMSGor OutputDebugStringto send messages indicating the thread's progress to the Output window in eVC. ... When you closesocket(), unless you've configured the socket for immediate close, it goes through a process to try to close the socket in a clean way, so that might take some time and I'm unsure whether closesocketwaits for that before returning or not. ... Now I'm trying to reproduce my error, but a new one occured. ... It's in totally new place where normally the app doesn't crash but I didn't notice it's not doing what it's expected to do. ...
    (microsoft.public.windowsce.embedded.vc)
  • TCP sockets -- accept() returns -1
    ... While debugging a mysterious crash in our application, the strace output ... The segmentation fault is because the program assumes a socket being ... then there is a connection pending to be ...
    (comp.os.linux.development.apps)
  • Re: How do I define the Source port value when creating a socket
    ... > Thanks so much for your advice. ... > But if I may ask, I tried to just do the Bindon the same socket I ... When you have a crash you need to record the location of it, ... another advice would be to stay away from MFC sockets wrappers and use plain ...
    (microsoft.public.win32.programmer.networks)
  • Datagram Socket Crashes when too much data to send!
    ... I have already started a topic on a problem related to Datagram Socket Speed ... If the Thread.Sleepline is commented, the application will crash almost ... an internal buffer, and stupidly crashes when this buffer is full. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: CAsyncsocket Attach and detach
    ... DLLs (of which the MFC and CRT runtimes are two of a couple dozen) and makes sure they are ... You can create installer files in VS.NET so there's no cost for a third-party ... I use CAsyncSocket to accept in OnAccept, detach the socket and set it ...
    (microsoft.public.vc.mfc)