java receiving connection at port
<p>i am using a single port to receive both files and messages in a messenger app. i wanted to ask how can i differenntiate between the files and the messages? i have researched and found that m going to have to make a protoco, i tried but i cant seem to make one. is there any way to accomplish this?</p>

<p>right now i am receiving the connection like this :</p>

<pre><code>public class ReceiveConnection extends Thread {

        Socket clientSocket = null;

        public ReceiveConnection(Socket socket) 
        {
            this.clientSocket = socket;

            SocketOperator.this.sockets.put(socket.getInetAddress(), socket);
        }

        @Override
        public void run() {
             try {

BufferedReader in = new BufferedReader(newInputStreamReader(clientSocket.getInputStream()));



                        while ((inputLine = in.readLine()) != null) {                



                             if (inputLine.contains("TEXT") == true)
                            {

                                Log.i("SocketOP","text");
                                appManager.messageReceived(inputLine);  
                        }


                        }
                         if (inputLine.contains("TEXT") == false)
                        {
                     InputStream is=clientSocket.getInputStream();

                 while(is!= null){
                            Log.i("SocketOP","filee");

appManager.fileReceived(is);
                     }


                        }
</code></pre>

<p>i have concatinated the string "TEXT" with my text message so it is coming through. putting an ELSE statement isnt working. how can i add a notifier with the file so that i know when the file is being received?</p>
