Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.io.InputStream;
- import java.net.Socket;
- public class Connection {
- public String SomeData;
- public Socket DataSocket;
- public InputStream xyz;
- public Connection(String SomeData, String address) throws IOException {
- DataSocket = new Socket(address, 10000);
- }
- public void connect(){
- try {
- xyz = DataSocket.getInputStream();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public void read() throws IOException {
- byte[] data = new byte[10];
- xyz.read(data);
- SomeData = new String(data);
- }
- public void close() throws IOException {
- xyz.close();
- }
- }
Add Comment
Please, Sign In to add comment