hey all. i'm having issue c# , quite possibly may debugger i'm new c# (not new c/c++)
there's code below. here issue i'm having.
i udp, not guaranteed delivery, sure. expect occasional packet dropped on network or windows if i'm stuffing pipe full. however, problem having after create new socket, try , send packet 1 byte of data. packet dropped. can try , send twice, it's dropped both times. however, if send 1k worth of data, goes through. if create socket (by clicking button again), works fine. here's weird thing. if stop , restart debugging project without making changes source, packets sent without problems. seems happen on first run after project built. anyway, here's code reproduce issue. after few hours of searching , reading i'm @ loss. edit: wanted clarify i'm using wireshark , can see packets dropped.
private void button1_click(object sender, eventargs e) { byte[] = new byte[1] {0x00}; byte[] b = new byte[1024]; for(int = 0; < 1024; i++) { b[i] = 0xff; } ipendpoint _ipep = new ipendpoint(ipaddress.parse("192.168.200.202"),5546); socket _server = new socket(addressfamily.internetwork, sockettype.dgram, protocoltype.udp); _server.sendto(a, 1, socketflags.none, _ipep); _server.sendto(a, 1, socketflags.none, _ipep); _server.sendto(b, 1024, socketflags.none, _ipep); }
from comment arp issue, suggest ways debug , narrow down issue , suggest solutions.
how debug:
try making arp entry "static" pc not send arp request each time. make arp entry static can write "arp" on command prompt see list of options , add static arp entry.
another idea open command prompt , write "ping 192.168.200.202 -t", pc keeps on pinging other client. keep pc's arp entry date , when run c# program, not send arp again, , directly send udp.
the above points debug , ensure guessed problem right.
the possible solutions:
- if arp issue, sure problem network switch, try replacing "switch" (i think faulty).
- if possible can think of making "arp entry" static. might not idea situations , totally depend if nature of application allows go approach.
i hope helps.
Comments
Post a Comment