Get Windows Phone 8 to use the network connected interface -
i'm writing test app windows phone 8 , testing in emulator. want create udp socket , determine local socket end point used. issue i've got emulator has 2 network interfaces 1 of has external network connectivity. default non-connected interface gets used. how can ensure correct adapter used when create socket?
socket m_socket = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); m_socket.setnetworkpreference(networkselectioncharacteristics.noncellular); socketasynceventargs receiveargs = new socketasynceventargs(); receiveargs.remoteendpoint = new ipendpoint(ipaddress.any, 0); receiveargs.setbuffer(new byte[2048], 0, 2048); receiveargs.completed += socketread_completed; // if bind specific ip address of connected adapter work. //m_socket.bind(new ipendpoint(ipaddress.parse("10.1.1.7"), 0)); // if leave wp8 wrong adapter gets used. m_socket.bind(new ipendpoint(ipaddress.any, 0)); m_socket.receiveasync(receiveargs);
Comments
Post a Comment