Here is the code:

Socket socket = null;
BufferedReader input=null;
PrintWriter output=null;
String fromUser = ...;

                try {
                        socket = new Socket(serverAdr, port);
                        output = new PrintWriter(socket.getOutputStream(), 
true);
                        input = new BufferedReader(new
InputStreamReader(socket.getInputStream()));
                } catch (UnknownHostException e) {
                        Log.e("Socket", "Don't know about host.");
                } catch (IOException e) {
                        Log.e("Socket", "Couldn't get I/O for the connection to 
server.");
                }

                if(fromUser!=null) {
                        Log.i("SocketOut", fromUser);
                        output.println(fromUser);
                }

                output.flush();

                String fromServer;

                try {
                        while ((fromServer = input.readLine()) != null) {
                                Log.i("SocketIn","Server: " + fromServer);
                        }
                } catch (IOException e) {
                        Log.e("SocketIn", e.getMessage());
                }

Help please!

Thanks a lot.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to