Hello,

I have next problem. I write client-server application, which should
be work in real device.
I have ClientActivity and ServerService.
Socket for client >>>>>>>>>>>>>>
                String localAdress = getLocalIpAddress();
                Socket s = new Socket(localAdress, 4444);
                OutputStream out = s.getOutputStream();
                PrintWriter output = new PrintWriter(out);
                output.println("dk");
                BufferedReader input = new BufferedReader(new
InputStreamReader(s.getInputStream()));
                String st = input.readLine();
                statusView.setText(st);
                s.close();
        } catch (UnknownHostException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
        }
<<<<<<<<<<<<<<<<<<<

ServerSocket for ServerService >>>>>>>>>>>
try {
                        ServerSocket ss = new ServerSocket(4444);
                        boolean end = false;
                        while(!end){
                                Socket s = ss.accept();
                                SocketPermission perm = new 
SocketPermission("localhost",
"connect, listen, accept, resolve");
                                BufferedReader input = new BufferedReader(new
InputStreamReader(s.getInputStream()));
                                PrintWriter output = new 
PrintWriter(s.getOutputStream(),true); //
Autoflush
                                String st = input.readLine();
                                Log.d("Tcp Example", "From client: "+st);
                                output.println("Pray to cyber god");
                                if ( st.equals("dk") ){
                                        end = true;
                                        s.close();
                                }
                        }
                        ss.close();
                } catch (UnknownHostException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
<<<<<<<<<<<<<<<<

I send data from Client. input object refresh after it, but call
readLine do not have affect. I test LocalSockets, but got the same
result. What do you think about it? I think about permissions. But i
have not SecurityEx.

Thanks.

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to