I am trying to establish connection between my tablet and pc via Upt sockets using wifi. I have working code written with using simple java Tcp sockets, so I just have changed sockets on udtsockets, but it didn't work!
I receive 0 bytes on tablet side:
int read = input.read(bytes); // read == 0
Here is my logs:
26.02.2013 12:20:32 udt.UDTClient <init>
INFO: Created client endpoint on port 7777
26.02.2013 12:20:33 udt.UDTSession <init>
INFO: Using udt.UDTCongestionControl
26.02.2013 12:20:33 udt.ClientSession <init>
INFO: Created udt.ClientSession@2efb56b1
26.02.2013 12:20:33 udt.UDPEndPoint addSession
INFO: Storing session <199>
26.02.2013 12:20:33 udt.UDPEndPoint start
INFO: UDTEndpoint started.
26.02.2013 12:20:37 udt.ClientSession sendHandShake
INFO: Sending ConnectionHandshake , mySocketID=199, initialSeqNo=721357864, packetSize=1400, maxFlowWndSize=1024, socketType=1, destSocketID=0]
26.02.2013 12:20:47 udt.ClientSession sendHandShake
INFO: Sending ConnectionHandshake , mySocketID=199, initialSeqNo=853667538, packetSize=1400, maxFlowWndSize=1024, socketType=1, destSocketID=0]
26.02.2013 12:20:47 udt.ClientSession received
INFO: Received connection handshake from Destination
ConnectionHandshake
26.02.2013 12:20:47 udt.UDTSession setState
INFO: udt.ClientSession@2efb56b1 connection state CHANGED to <2>
26.02.2013 12:20:47 udt.ClientSession connect
INFO: Connected, 20 handshake packets sent
26.02.2013 12:20:47 udt.UDTClient connect
INFO: The UDTClient is connected
26.02.2013 12:20:54 udt.UDTSender start
INFO: Starting sender for udt.ClientSession@2efb56b1
public static void main(String[] args) throws Exception {
UDTClient socket = new UDTClient(Inet4Address.getByName("192.168.137.249"), 7777);
socket.connect("192.168.137.249", 7777);
UDTOutputStream output = socket.getOutputStream();
byte[] bytes = new byte[1024 * 10]; // 10K
for (int i = 0; i < bytes.length; i++) {
bytes[i] = 12;
} // fill the bytes
// send them again and again
while (true) {
output.write(bytes);
}
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks for your interest and sorry that it does not work for you. Your code looks OK of course, maybe you should add
a "flush() after calling outputStream.write() The UDT sockets do not quite work the same way as normal TCP sockets (especially there is no -1 for End-of-stream!)
1) are you using the SVN trunk or the latest "release" version? Not sure that trunk is OK, unfortunately I don't have too much time for this project at the moment
2) does it work for you on the same machine (i.e. two processes on the same PC) ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I checked out, it is working on same machine in two threads, but test results are horrible. 0.5 MB/s against 159 MB/s by simple tcp. Of course it is not network case at all, but why is such big difference?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
my experience with wireless networks was also very bad. In a wired network it was better but still nowhere as fast as TCP. The point is that TCP is usually your best choice, because in UDP based protocols (when you need reliable transfer) you have to build the whole reliability layer in (Java) code. The C++ version of UDT is very good and fast, but our Java version is not nearly as good :(
Summary: if you can use TCP, use it ;)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am trying to establish connection between my tablet and pc via Upt sockets using wifi. I have working code written with using simple java Tcp sockets, so I just have changed sockets on udtsockets, but it didn't work!
I receive 0 bytes on tablet side:
int read = input.read(bytes); // read == 0
Here is my logs:
Android side:
PC side:
Unfortunately I can't test same sample on too pc's because I haven't got second one
hi,
thanks for your interest and sorry that it does not work for you. Your code looks OK of course, maybe you should add
a "flush() after calling outputStream.write() The UDT sockets do not quite work the same way as normal TCP sockets (especially there is no -1 for End-of-stream!)
1) are you using the SVN trunk or the latest "release" version? Not sure that trunk is OK, unfortunately I don't have too much time for this project at the moment
2) does it work for you on the same machine (i.e. two processes on the same PC) ?
I am using udt-java-0.5-SNAPSHOT.jar - last change 2010.09.23
I also added flush but nothing has changed.
Thank you for quick reply btw=)
I checked out, it is working on same machine in two threads, but test results are horrible. 0.5 MB/s against 159 MB/s by simple tcp. Of course it is not network case at all, but why is such big difference?
Is UDT work's in Wireless Network?
hi,
my experience with wireless networks was also very bad. In a wired network it was better but still nowhere as fast as TCP. The point is that TCP is usually your best choice, because in UDP based protocols (when you need reliable transfer) you have to build the whole reliability layer in (Java) code. The C++ version of UDT is very good and fast, but our Java version is not nearly as good :(
Summary: if you can use TCP, use it ;)