URL
https://opencores.org/ocsvn/udp_ip_stack/udp_ip_stack/trunk
[/] [udp_ip_stack/] [tags/] [v2.1/] [sw/] [UDPTest.java] - Diff between revs 2 and 21
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 2 |
Rev 21 |
package com.pjf;
|
package com.pjf;
|
|
|
import java.io.IOException;
|
import java.io.IOException;
|
import java.net.SocketException;
|
import java.net.SocketException;
|
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
|
|
public class UDPTest {
|
public class UDPTest {
|
private UDPCxn cxn;
|
private UDPCxn cxn;
|
|
|
public UDPTest() throws SocketException, UnknownHostException {
|
public UDPTest() throws SocketException, UnknownHostException {
|
cxn = new UDPCxn("192.168.5.9");
|
cxn = new UDPCxn("192.168.5.9");
|
}
|
}
|
|
|
public void go() throws IOException {
|
public void go() throws IOException {
|
String fix1 = "1=45~34=201~18=23~";
|
String fix1 = "1=45~34=201~18=23~";
|
cxn.fixSend(fix1, 2000, true);
|
cxn.fixSend(fix1, 2000, true);
|
byte[] rep = cxn.rcv();
|
byte[] rep = cxn.rcv();
|
String reply = new String(rep);
|
String reply = new String(rep);
|
System.out.println("Got [" + reply + "]");
|
System.out.println("Got [" + reply + "]");
|
}
|
}
|
|
|
|
|
public static void main(String[] args) {
|
public static void main(String[] args) {
|
UDPTest ut;
|
UDPTest ut;
|
try {
|
try {
|
ut = new UDPTest();
|
ut = new UDPTest();
|
ut.go();
|
ut.go();
|
} catch (Exception e) {
|
} catch (Exception e) {
|
e.printStackTrace();
|
e.printStackTrace();
|
}
|
}
|
}
|
}
|
|
|
|
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.