In this patch the IP/DSCP code default of Best-effort (000000) is changed to Class 5 (101000), activating priority on ethernet and wireless (WMM) . Correctness proved by wireshack capture, only thing is some TCP handshake still are issued with best-effort. Also i have an experimental UDP engine but the only thing left is to make the PS3 recognize that the server is alive, responding the issued SYN, with a SYN-ACK, to further test.
Email for contact: brunogm0@gmail.com
Links used:
WMM QoS: http://en.wikipedia.org/wiki/802.11e
Testing if WMM is effectively enabled and its benefits:
http://www.smallnetbuilder.com/wireless/wireless-features/30837-does-wi-fi-multimedia-wmm-really-do-anything-part-1
http://www.smallnetbuilder.com/wireless/wireless-features/30837-does-wi-fi-multimedia-wmm-really-do-anything-part-2
http://www.smallnetbuilder.com/wireless/wireless-features/30837-does-wi-fi-multimedia-wmm-really-do-anything-part-3
Theoretical limits on Bandwidth:
802.11g only Max Link 54Mbps Max TCP 24.4Mbps Max UDP 30.5Mbps
PATCH:
- Code: Select all
Index: net/pms/network/HTTPServer.java
===================================================================
--- net/pms/network/HTTPServer.java (revision 410)
+++ net/pms/network/HTTPServer.java (working copy)
@@ -117,25 +124,28 @@
address = new InetSocketAddress(port);
}
PMS.minimal("Created socket: " + address);
if (!PMS.getConfiguration().isHTTPEngineV2()) {
serverSocketChannel = ServerSocketChannel.open();
serverSocket = serverSocketChannel.socket();
serverSocket.setReuseAddress(true);
+ serverSocket.setPerformancePreferences(0, 1, 2);
serverSocket.bind(address);
if (hostName == null && iafinal !=null)
hostName = iafinal.getHostAddress();
else if (hostName == null)
hostName = InetAddress.getLocalHost().getHostAddress();
runnable = new Thread(this);
runnable.setDaemon(false);
runnable.start();
} else {
+
group = new DefaultChannelGroup("myServer");
factory = new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(),
@@ -143,19 +153,27 @@
ServerBootstrap bootstrap = new ServerBootstrap(factory);
HttpServerPipelineFactory pipeline = new HttpServerPipelineFactory();
bootstrap.setPipelineFactory(pipeline);
+ bootstrap.setOption("tcpNoDelay", true);
bootstrap.setOption("child.tcpNoDelay", true);
+ bootstrap.setOption("keepAlive", true);
bootstrap.setOption("child.keepAlive", true);
bootstrap.setOption("reuseAddress", true);
bootstrap.setOption("child.reuseAddress", true);
bootstrap.setOption("child.sendBufferSize", 65536);
bootstrap.setOption("child.receiveBufferSize", 65536);
+ bootstrap.setOption("trafficClass", 160); // DSCP class 5, AC_VID has 6 bit MSB 40 decimal value, concatenated with 2bit ECN value 00
+ bootstrap.setOption("child.trafficClass", 160);
+
+ PMS.debug("Bootstrap Channel Traffic class " + bootstrap.getOption("trafficClass"));
+ PMS.debug("Bootstrap Child Traffic class " + bootstrap.getOption("child.trafficClass"));
channel = bootstrap.bind(address);
group.add(channel);
if (hostName == null && iafinal !=null)
hostName = iafinal.getHostAddress();
else if (hostName == null)
hostName = InetAddress.getLocalHost().getHostAddress();
}
return true;
Index: net/pms/network/UPNPHelper.java
===================================================================
--- net/pms/network/UPNPHelper.java (revision 410)
+++ net/pms/network/UPNPHelper.java (working copy)
@@ -76,6 +76,10 @@
try
{
DatagramSocket ssdpUniSock = new DatagramSocket();
+ ssdpUniSock.setTrafficClass(160); //DSCP class 5: 0x28, ECN: 0x00
+ PMS.debug("Reply Traffic class " + ssdpUniSock.getTrafficClass());
PMS.debug( "Sending this reply [" + host + ":" + port + "]: " + StringUtils.replace(msg, CRLF, "<CRLF>"));
InetAddress inetAddr = InetAddress.getByName(host);
@@ -134,9 +138,11 @@
PMS.debug("Multicast socket is on interface: " + ssdpSocket.getInterface());
ssdpSocket.setTimeToLive(32);
//ssdpSocket.setLoopbackMode(true);
+ ssdpSocket.setTrafficClass(160); //DSCP class 5: 0x28, ECN: 0x00
ssdpSocket.joinGroup(getUPNPAddress());
PMS.debug("Socket Timeout: " + ssdpSocket.getSoTimeout());
PMS.debug("Socket TTL: " + ssdpSocket.getTimeToLive());
+ PMS.debug("Socket Traffic Class: " + ssdpSocket.getTrafficClass());
return ssdpSocket;
}
@@ -213,7 +219,9 @@
socket.setNetworkInterface( PMS.get().getServer().getNi());
}
socket.setTimeToLive(4);
+ socket.setTrafficClass(160); //DSCP class 5: 0x28, ECN: 0x00
socket.setReuseAddress(true);
+ PMS.debug("Multicast Traffic class " + socket.getTrafficClass());
socket.joinGroup(getUPNPAddress());
while(true)
{
