I have written the basic socket program for the server and the client.I would like to know how to transfer data from server to client using java and also while the server is sending data if the client buffer overflows the server should reduce its sending rate(the congestion should be indicated by ECN bit in tcp/ip).....thank you for any help.
问题:
回答1:
ECN field is a property of IP and Transport layer. Therefore, I don't think you can set it from an ordinary application. One way to do it would be to create RAW Socket and craft packets yourself with proper fields set (ECN in your case) in TCP/IP header.
You should also note, all routers and participating end-hosts will have to have ECN support. Otherwise, routers may just drop the packet or arbitrarily set the ECN value to zero.
Google was able to find me some Java libraries with raw socket support which you would find here.
回答2:
You can enable or disable ECN capabilities using cmd command - netsh interface tcp set global ecncapability=enabled
When you enable ECN capabilities TCP header automatically set ECN and CWR flag.
https://www.saotn.org/explicit-congestion-notification-ecn-slows-outbound-connections/