Re: Please Help!!! - CAsyncSocket::OnReceive Not Working for Microsoft UDP Application (msocudp)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Roshan" <roshan@xxxxxxxxxxxx> wrote in message news:8da3087e-5c1e-4633-b70a-94c533136fb7@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scott,

Hello. Hope you're weekend went well. I am now trying threading with
UDP sockets. On my first try it seems
the OnReceive() is not getting invoked when sending a packet in a
thread.
Please let me know what I might be doing wrong here.

Snippets of my code:

The code can be pretty much thrown away. It seems to have been written without studying the CAsyncSocket documentation or examples at all. You must create the socket in the same thread that you want to receive and send from. There are MFC examples that illustrate this. You must use a UI type of MFC thread. There are MFC examples that illustrate this. And, your thread code only works if you receive the expected 10 packets. UDP IS NOT RELIABLE. You can not and must not assume that you will receive all the packets. And finally, what is the point of suspending your main thread until the socket thread completes? This is fundamentally wrong in any Windows program: It will lock up your window.

I am not optimistic that you can complete this assignment, and if you must rely on UDP to give you all the packets then it is an impossible assignment :(

--
Scott McPhillips [VC++ MVP]

.



Relevant Pages

  • Overhead, UDP: Many packets on 1 socket vs. one packet and many sockets.
    ... gigabit LAN network using UDP. ... information in the data packets. ... Create a new socket for each of these new pieces of data. ...
    (comp.unix.programmer)
  • Re: Send-Q on UDP socket growing steadily - why?
    ... Send-Q on a moderately active UDP socket keeps growing steadily until it reaches ~128K at which point socket writes start failing. ... The application in question is standard ntpd from Fedora 7, kernel is the latest available for the distro, that is ... "I don't know how to send these packets" mode forever. ...
    (Linux-Kernel)
  • Re: Loosing UDP packets...
    ... The applications I support send lots of UDP via ... Sometimes all the packets hit the wire, ... Perhaps that is only for a non-blocking socket - per my stuff above? ... as I don't send> MTU datagrams. ...
    (comp.os.linux.networking)
  • Re: bind() udp behavior 2.6.8.1
    ... >any firewall must keep some sort of state table even if it is udp. ... UDP is connectionless. ... **arbitrary** packets. ... the socket is allocated once for the whole program. ...
    (Linux-Kernel)
  • Re: Problem with writing fast UDP server
    ... UDP packets per second. ... socket and threads. ... I wrote a simple case test: client and server. ... The maximum theoretical limit is 14,880 frames per ...
    (comp.lang.python)