Hi all,

I create and open a socket like this:

try {
                socket = new Socket();
                InetSocketAddress addr = new InetSocketAddress(hostName,
port);
                socket.connect(addr);

                dis = new DataInputStream(socket.getInputStream());
                dos = new DataOutputStream(socket.getOutputStream());

        } catch(IOException e) {
                state = PEConnectionStateError;
                Log.d(TAG, "Open failed", e);
                return false;
        }

which succeeds. Later on, I try to write a message to the socket,
which consists of
                super.writeToStream(os); // writes two ints
                os.writeInt(version);
                os.writeInt(flags);
                os.writeUTF(sessionId);
                os.writeUTF(clientId);
                os.writeInt(sequenceId);
                os.writeInt(sequenceHash);

At the writeInt(flags), I get a java.net.SocketException: Broken pipe.
I'm not sure, but I don't think the server ever sees the connection. I
do have  <uses-permission android:name="android.permission.INTERNET" /
> in the manifest.

Is there some sort of setup I need to do in Eclipse or the emulator to
get this to work? Has anyone else gotten a sockets app working?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to