I need to send a UDP packet to specified IP & port with Specified local/source port.
How do I do it ? this is what I want to work
sockets.socket = wip_UDPCreateOpts( evh_udp, &sockets, WIP_COPT_PEER_STRADDR, Globals.servername, WIP_COPT_PEER_PORT, PEER_PORT, WIP_COPT_PORT, LOCAL_PORT, WIP_COPT_END); case WIP_CEV_WRITE: // socket is writable wip_getOpts(ev->channel, WIP_COPT_PEER_ADDR, &sockets.PeerIPaddr, WIP_COPT_BOUND, &sockets.isbound, WIP_COPT_END ); error = wip_writeOpts( sockets.socket, "hello",5, WIP_COPT_PEER_ADDR, sockets.PeerIPaddr, WIP_COPT_PEER_PORT, PEER_PORT, WIP_COPT_PORT, LOCAL_PORT, WIP_COPT_END);
However, after trying all permutations of UDP server sockets & client sockets, all I can say is that Server sockets only send from a “Bound” incoming port, ie you cannot send until received. & client sockets do not accept wip_writeOpts() - I’m trying to do a bit of both.
I am wrestling with this wip lib there is no consistent “philosophy” to it, everything works as per the examples/docs but deviate even slightly & it does not work. for example using the same code for multiple bound/unbound UDP sockets + TCP sockets.
wip_readOpts() nor wip_GetOpts() work on TCP client sockets
wip_read() does not work on UDP sockets
You cannot use wip_writeOpts() with a Server socket, despite secifying every thing, cause the “channel not ready” ie it wants the channel from an incoming packet/connection (does not exist yet)