Datagram Socket on 2.5.3

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nurfus
In need of some credit
In need of some credit
Posts: 3
Joined: Tue Oct 19, 2004 10:33 am

Datagram Socket on 2.5.3

Post by nurfus » Tue Oct 26, 2004 1:08 pm

1.
udp_s = new wxDatagramSocket(addr, udp_flags);
seems not to open anything, since my firewall detects nothing

udp_s->RecvFrom(addr, net_buffer, datasize);
then makes the fw alert.

It dont seem to work correctly, does it ?

2. I want to setup Listeners like this :

udp_s->SetEventHandler(*this, SOCKET_ID);
udp_s->SetNotify(wxSOCKET_INPUT_FLAG);
udp_s->Notify(TRUE);

Dont seems to work either.

Any Suggestions ?
thx

upCASE
Site Admin
Site Admin
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE » Tue Oct 26, 2004 1:50 pm

Hi!
udp_s = new wxDatagramSocket(addr, udp_flags);
seems not to open anything, since my firewall detects nothing
UDP sockets (or UDP in general) works connectionless (see: http://en.wikipedia.org/wiki/User_Datagram_Protocol). It's not like there is a server that would listen on a specific port and thus making the fw alarm ring. Instead a UDP socket is more like a "data-canon" that may shoot data at some target, but doesn't wait for a reply.
udp_s->RecvFrom(addr, net_buffer, datasize);
then makes the fw alert.
Correct. It's a one-shot...
I want to setup Listeners like this :
udp_s->SetEventHandler(*this, SOCKET_ID);
udp_s->SetNotify(wxSOCKET_INPUT_FLAG);
udp_s->Notify(TRUE);
I'd suggest using normal TCP sockets, since to me this looks like connection based communication.

Have a look at some UDP DNS server/client implementations. Except from using it as a "data-canon" I'd recommend using normal TCP Sockets in wxWidgets.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda

Post Reply