Skip to content
Snippets Groups Projects
Commit e3555b70 authored by Brutzman, Don's avatar Brutzman, Don
Browse files

Merge origin/master

parents be111413 9c928f4d
No related branches found
No related tags found
No related merge requests found
......@@ -37,13 +37,13 @@ public class ABEspduReceiverB {
// Specify the socket to receive data
socket = new MulticastSocket(3101);
socket.setBroadcast(true);
int connectionCount = 0;
ServerSocket serverSocket = new ServerSocket(2999);
Socket clientConnection = serverSocket.accept();
//int connectionCount = 0;
// ServerSocket serverSocket = new ServerSocket(2999);
//Socket clientConnection = serverSocket.accept();
InputStream is = clientConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
//InputStream is = clientConnection.getInputStream();
//InputStreamReader isr = new InputStreamReader(is);
//BufferedReader br = new BufferedReader(isr);
address = InetAddress.getByName(GROUP);
socket.joinGroup(address);
......@@ -62,18 +62,18 @@ public class ABEspduReceiverB {
String serverMessage = br.readLine();
System.out.println("The message the client sent was " + serverMessage);
//String serverMessage = br.readLine();
//System.out.println("The message the client sent was " + serverMessage);
// Print some information locally about the Socket
// connection. This includes the port and IP numbers
// on both sides (the socket pair.)
InetAddress localAddress = clientConnection.getLocalAddress();
InetAddress remoteAddress = clientConnection.getInetAddress();
// InetAddress localAddress = clientConnection.getLocalAddress();
//InetAddress remoteAddress = clientConnection.getInetAddress();
int localPort = clientConnection.getLocalPort();
int remotePort = clientConnection.getPort();
//int localPort = clientConnection.getLocalPort();
//int remotePort = clientConnection.getPort();
// My socket pair connection looks like this, to localhost:
// Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54876 ))
......@@ -83,10 +83,10 @@ public class ABEspduReceiverB {
// different ports?
System.out.println("Socket pair: (( " + localAddress.toString() + ", " + localPort + " ), ( " +
remoteAddress.toString() + ", " + remotePort + " ))");
//System.out.println("Socket pair: (( " + localAddress.toString() + ", " + localPort + " ), ( " +
// remoteAddress.toString() + ", " + remotePort + " ))");
System.out.println("Connection count is: " + connectionCount);
//System.out.println("Connection count is: " + connectionCount);
List<Pdu> pduBundle = pduFactory.getPdusFromBundle(packet.getData());
System.out.println("Bundle size is " + pduBundle.size());
......
......@@ -56,6 +56,7 @@ public static void main(String args[])
try
{
destinationIp = InetAddress.getByName(DEFAULT_MULTICAST_GROUP);
}
catch(Exception e)
{
......@@ -151,6 +152,13 @@ public static void main(String args[])
// Loop through sending N ESPDUs
try
{
int connectionCount = 0;
ServerSocket serverSocket = new ServerSocket(2999);
Socket clientConnection = serverSocket.accept();
InputStream is = clientConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
System.out.println("Sending " + NUMBER_TO_SEND + " ESPDU packets to " + destinationIp.toString());
for(int idx = 0; idx < NUMBER_TO_SEND; idx++)
{
......@@ -232,6 +240,32 @@ public static void main(String args[])
FirePdu fire = new FirePdu();
byte[] fireArray = fire.marshal();
String serverMessage = br.readLine();
System.out.println("The message the client sent was " + serverMessage);
// Print some information locally about the Socket
// connection. This includes the port and IP numbers
// on both sides (the socket pair.)
InetAddress localAddress = clientConnection.getLocalAddress();
InetAddress remoteAddress = clientConnection.getInetAddress();
int localPort = clientConnection.getLocalPort();
int remotePort = clientConnection.getPort();
// My socket pair connection looks like this, to localhost:
// Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54876 ))
// Socket pair: (( /0:0:0:0:0:0:0:1, 2317 ), ( /0:0:0:0:0:0:0:1, 54881 ))
//
// Why is the first IP/port the same, while the second set has
// different ports?
System.out.println("Socket pair: (( " + localAddress.toString() + ", " + localPort + " ), ( " +
remoteAddress.toString() + ", " + remotePort + " ))");
System.out.println("Connection count is: " + connectionCount);
// The byte array here is the packet in DIS format. We put that into a
// datagram and send it.
byte[] data = baos.toByteArray();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment