File tree Expand file tree Collapse file tree 1 file changed +44
-2
lines changed
src/javagameengine/networking Expand file tree Collapse file tree 1 file changed +44
-2
lines changed Original file line number Diff line number Diff line change 99import java .net .ServerSocket ;
1010import java .net .Socket ;
1111
12- public class Tcp_server extends Thread {
12+ class socket_handler implements Runnable {
13+ public Thread t ;
1314 public ServerSocket socket ; // Socket to listen on
1415 public Socket i_socket ; // Start listening on socket
1516
16- public Tcp_server ()
17+ @ Override
18+ public void run () {
19+
20+ }
21+
22+ public socket_handler (String _lineup_id )
1723 {
24+ t = new Thread (this , "t_client_" + _lineup_id );
25+ t .start ();
1826 try {
1927 socket = new ServerSocket (8074 );
2028 i_socket = socket .accept ();
@@ -45,3 +53,37 @@ public BufferData read_client()
4553 return parsed ;
4654 }
4755}
56+
57+ public class Tcp_server extends Thread {
58+
59+ public Tcp_server ()
60+ {
61+ Tcp_server thread = new Tcp_server ();
62+ thread .start ();
63+ }
64+
65+ // Connected lineup ** List of connected clients **
66+ public int lineup_id = 0 ;
67+
68+ public String client_joined ()
69+ {
70+ lineup_id = lineup_id ++;
71+ return Integer .toString (lineup_id );
72+ }
73+
74+ public void client_left ()
75+ {
76+ // We don't handle any queues. Meaning it doesn't matter what the ID is as long as they don't conflict.
77+ // So this is just a security measure to make sure that it doesn't happen.
78+ lineup_id = lineup_id ++;
79+ }
80+
81+ public void listenFor_lineup ()
82+ {
83+
84+ }
85+
86+ public void read_lineup ()
87+ {
88+ }
89+ }
You can’t perform that action at this time.
0 commit comments