Wi-Fi P2P Data transfer

I have an android app that I would like to make it be able compare data via wi-fi p2p. I understand the connection method (1. Set up app. permissions; set up broadcast reciever and P2P manager; initiate peer descovery; connect to peer) But I have a problem when it comes to data transfer. My app's interface has some drop-down menus with several options to select from. I was wondering, how can I make the selected options (once the app users connect to each other) be able to compare data and notify the app users if they have mutual selections.
Will this code work?

    //SERVER
public static class FileServerAsyncTask extends AsyncTask {

    private Context context;
    private TextView statusText;

    public FileServerAsyncTask(Context context, View statusText) {
        this.context = context;
        this.statusText = (TextView) statusText;
    }

    @Override
    protected String doInBackground(Void... params) {
        try {

            /**
             * Create a server socket and wait for client connections. This
             * call blocks until a connection is accepted from a client
             */
            ServerSocket serverSocket = new ServerSocket(8888);
            Socket client = serverSocket.accept();

            /**
             * If this code is reached, a client has connected and transferred data
                          */
            var pGender:String
            var pDesire:String
            var pAge:String
            var pRace:String
            var pWeight:String
            var pHeight:String
            var dGender:String = dGender.getValue(dGender.selectedItem.data);
            var pDesire:String = pDesire.getValue(pDesire.selectedItem.data);
            var dRace:String = dRace.getValue(dRace.selectedItem.data);
            var dAge:String = dAge.getValue(dAge.selectedItem.data);
            var dHeight:String = dHeight.getValue(dHeight.selectedItem.data);
            var dWeight:String = dWeight.getValue(dWeight.selectedItem.data);

            if (pGender == dGender.selectedItem.data && pDesire == pDesire.selectedItem.data && pRace == dRace.selectedItem.data && pWeight == dWeight.selectedItem.data && pHeight == dHeight.selectedItem.data)
            {
            trace (jump to frame 110 + vibrate);
            }
            else
            {
            trace (jump to frame 138 + vibrate + jump to frame 10) ; 
            }
            return results;

        }


            InputStream inputstream = client.getInputStream();
            copyFile(inputstream, new FileOutputStream(f));
            serverSocket.close();
            return f.getAbsolutePath();
        } catch (IOException e) {
            Log.e(WiFiDirectActivity.TAG, e.getMessage());
            return null;
        }
    }

    /**
     * Start activity that can handle the JPEG image
     */
    @Override
    protected void onPostExecute(String result) {
        if (result != null) {
            statusText.setText("File copied - " + result);
            Intent intent = new Intent();
            intent.setAction(android.content.Intent.ACTION_VIEW);
            intent.setDataAndType(Uri.parse("file://" + result), "image/*");
            context.startActivity(intent);
        }
    }
}

Then the on the client I have this:

 //CLIENT
Context context = this.getApplicationContext();
String host;
int port;
int len;
Socket socket = new Socket();
byte buf[]  = new byte[1024];
...
try {
    /**
     * Create a client socket with the host,
     * port, and timeout information.
     */
    socket.bind(null);
    socket.connect((new InetSocketAddress(host, port)), 500);

    /**
     * Create a byte stream from a JPEG file and pipe it to the output stream
     * of the socket. This data will be retrieved by the server device.
     */
    OutputStream outputStream = socket.getOutputStream();
    ContentResolver cr = context.getContentResolver();
    InputStream inputStream = null;
    /*varibles declaration
    */
    pGender.getValue(pGender.selectedItem.data);
    pDesire.getValue(pDesire.selectedItem.data);
    pRace.getValue(pRace.selectedItem.data);
    pAge.getValue(pAge.selectedItem.data);
    pHeight.getValue(pHeight.selectedItem.data);
    pWeight.getValue(pWeight.selectedItem.data);

    inputStream = cr.openInputStream(Uri.parse(DataProvider.getItemAt(pGender:String, pDesire:String, pRace:String, pAge:String, pHeight:String, pWeight:String):Object));
    while ((len = inputStream.read(buf)) != -1) {
        outputStream.write(buf, 0, len);
    }
    outputStream.close();
    inputStream.close();
} catch (FileNotFoundException e) {
    //catch logic
} catch (IOException e) {
    //catch logic
}

/**
 * Clean up any open sockets when done
 * transferring or if an exception occurred.
 */
finally {
    if (socket != null) {
        if (socket.isConnected()) {
            try {
                socket.close();
            } catch (IOException e) {
                //catch logic
            }
        }
    }
}