package net.floodlightcontroller.headerextract;

import java.net.InetSocketAddress;
import java.net.Socket;
import java.io.BufferedOutputStream;
 
public class SocketClient {
    private String address = "140.113.215.4";// 連線的ip
    private int port = 8765;// 連線的port
 
    public SocketClient() {
    	this(99999);
    }
    public SocketClient(int Association_ID) {
 
        Socket client = new Socket();
        InetSocketAddress isa = new InetSocketAddress(this.address, this.port);
        try {
            client.connect(isa, 10000);
            BufferedOutputStream out = new BufferedOutputStream(client
                    .getOutputStream());
            // 送出字串
            String msg = Integer.toString(Association_ID);
            out.write(msg.getBytes());
            out.flush();
            out.close();
            out = null;
            client.close();
            client = null;
 
        } catch (java.io.IOException e) {
            System.out.println("Socket連線有問題 !");
            System.out.println("IOException :" + e.toString());
        }
    }
 
   /* public static void main(String args[]) {
        new SocketClient(1114555666);
    }*/
}

@@ -138,17 +138,137 @@
 Stream;%0A
- 
+import java.io.ObjectOutputStream;%0Aimport org.json.JSONArray;%0Aimport org.json.JSONException;%0Aimport org.json.JSONObject;%0A
 %0Apublic 
@@ -416,16 +416,18 @@
  %7B%0A    %09
+//
 this(999
@@ -465,26 +465,25 @@
 ent(
-int Association_ID
+JSONObject record
 ) %7B%0A
@@ -616,32 +616,38 @@
   try %7B%0A    
+    %09%0A
         
 client.conne
@@ -626,32 +626,35 @@
       %09%0A        
+%09/*
 client.connect(i
@@ -656,17 +656,16 @@
 ect(isa,
- 
 10000);%0A
@@ -676,24 +676,22 @@
         
-Buffered
+Object
 OutputSt
@@ -705,16 +705,339 @@
 t = new 
+ObjectOutputStream(client.getOutputStream());%0A            //%E9%80%81%E5%87%BAobject%0A            out.writeObject(record);%0A            out.flush();%0A            out.close();%0A            out = null ;%0A            client.close();%0A            client = null ;*/%0A%0A            client.connect(isa, 10000);%0A            BufferedOutputStream out = new 
 Buffered
@@ -1059,29 +1059,8 @@
 ient
-%0A                    
 .get
@@ -1125,15 +1125,14 @@
 g = 
-Integer
+record
 .toS
@@ -1141,22 +1141,8 @@
 ing(
-Association_ID
 );%0A 

Update SocketClient.java