Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
package com.android.chat; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; public class Chat extends Activity implements OnClickListener { private EditText etChat; private EditText etInfos; private Button bEnviar; private Button bDesligar; private Button bLigarServer; private Button bLigarClient; private ListView lvConversa; private TextView tvChat; private boolean isServer = false; private boolean isClient = false; //cliente Socket socketCliente; String hostIpServidor; int portoServidor; PrintWriter outClient; TCPClient tcpclient; //Servidor int portoEscutaGeral; ServerSocket socketGeralServidor; PrintWriter outServer; TCPServer tcpserver; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); etChat = (EditText)findViewById(R.id.EditText01); etInfos = (EditText)findViewById(R.id.EditText02); lvConversa = (ListView)findViewById(R.id.ListView01); tvChat = (TextView)findViewById(R.id.TextView01); bEnviar = (Button)findViewById(R.id.Button01); bEnviar.setOnClickListener((OnClickListener)this); bDesligar = (Button)findViewById(R.id.Button02); bDesligar.setOnClickListener((OnClickListener)this); bLigarServer = (Button)findViewById(R.id.Button03); bLigarServer.setOnClickListener((OnClickListener)this); bLigarClient = (Button)findViewById(R.id.Button04); bLigarClient.setOnClickListener((OnClickListener)this); } private Handler handlerCliente = new Handler() { public void handleMessage(Message msg) { // processar mensagem if (msg.what == 0) { tvChat.append("Servidor diz: " + (String)msg.obj); } } }; Handler handlerServidor = new Handler() { public void handleMessage(Message msg) { // processar mensagem if (msg.what == 0){ tvChat.append("Cliente diz: " + (String)msg.obj); } } }; public void onClick(View v) { switch(v.getId()){ case R.id.Button01: try { if (isClient){ //desligarCliente(); socketCliente.close(); isClient = false; } else if (isServer){ //desligarServidor();//só fecha socket que o servidor tinha aberta para este cliente tcpserver.getSocketServerCliente().close(); isServer = false; } }catch (IOException ioe) { ioe.printStackTrace(); } break; case R.id.Button02: try { if (isClient) { outClient = new PrintWriter(socketCliente.getOutputStream(), true); outClient.println(etChat.getText().toString() + "\n"); } else if (isServer){ outServer = new PrintWriter(tcpserver.getSocketServerCliente().getOutputStream(), true); outServer.println(etChat.getText().toString() + "\n"); } } catch (IOException ioe) { ioe.printStackTrace(); } break; case R.id.Button03: isServer = true; //lerDadosServidor(); portoEscutaGeral = Integer.parseInt(etInfos.getText().toString()); //ligarServidor(); try { socketGeralServidor = new ServerSocket(portoEscutaGeral); socketGeralServidor.bind(socketGeralServidor.getLocalSocketAddress(), 10); //receberInfoServidor() tcpserver = new TCPServer(socketGeralServidor, handlerServidor); Thread threadServer = new Thread(tcpserver); threadServer.start(); } catch (IOException ioe) { ioe.printStackTrace(); } break; case R.id.Button04: isClient = true; //lerDadosCliente(); String[] meu = etInfos.getText().toString().split(":"); hostIpServidor = meu[0]; portoServidor = Integer.parseInt(meu[1]); //ligarCliente(); try { InetAddress serverAddr = InetAddress.getByName(hostIpServidor); socketCliente = new Socket(serverAddr, portoServidor/*"10.101.226.2", 4444*/); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if(socketCliente.isConnected()){ // o socket do cliente esta pronto para enviar e receber mensagens } //receberInfoCliente(); tcpclient = new TCPClient(socketCliente, handlerCliente); Thread threadClient = new Thread(tcpclient); threadClient.start(); break; } } }