package ru.analgin.love; import java.net.*; import java.io.*; import android.app.*; public class Connector { int flag = 0; public Socket connect(String m_host, int m_port) throws IOException { Socket soc = new Socket(); boolean go; soc.connect(new InetSocketAddress(m_host, m_port),5000); flag++; return soc; } public String send(String data) throws IOException { Socket soc = connect("185.28.21.26",80); OutputStream get = soc.getOutputStream(); if(flag>0) { byte buf[] = (data).getBytes(); get.write(buf); } else { return "Ошибка подключения"; } return "Подключено"; } public String read() throws IOException { Socket soc = connect("185.28.21.26",80); InputStream set = soc.getInputStream(); return set.toString(); } public int count() { return flag; } }