Guest User

Untitled

a guest
Jan 12th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. package server;
  2.  
  3. import java.io.DataInputStream;
  4. import java.io.DataOutputStream;
  5. import java.io.IOException;
  6. import java.net.Socket;
  7.  
  8. public class GameThread extends Thread{
  9. DataInputStream in;
  10. DataOutputStream out;
  11. private Socket socket;
  12. private boolean isHost;
  13.  
  14. public GameThread(Socket skt) throws IOException {
  15. super("GameThread");
  16. socket = skt;
  17. in = new DataInputStream(socket.getInputStream());
  18. out = new DataOutputStream(socket.getOutputStream());
  19. }
  20.  
  21. public String getUsername() throws IOException {
  22. String name = in.readUTF();
  23. return name;
  24. }
  25.  
  26. public void setUserList(String list) throws IOException {
  27. out.writeUTF(list);
  28. out.flush();
  29. }
  30. }
Add Comment
Please, Sign In to add comment