Author:
ivj94 (posted
2018-03-24 14:46:31 , viewed 49 times)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public class GameServer extends Thread {
private ServerSocket server ;
public GameServer () throws IOException {
try {
doPortForwarding ();
server = new ServerSocket (10000 );
} catch (SocketException e ) {
e .printStackTrace ();
}
}
public void run () {
while (true ) {
try {
Socket s = server .accept ();
System .out .println ("Accepted" );
} catch (IOException ex ) {
Logger .getLogger (GameServer .class .getName ()).log (Level .SEVERE , null , ex );
}
}
}
private void doPortForwarding () throws UnknownHostException {
PortMapping [] desiredMapping = new PortMapping [1 ];
desiredMapping [0 ] = new PortMapping (10000 , InetAddress .getLocalHost ().getHostAddress (),
PortMapping .Protocol .TCP , " TCP POT Forwarding" );
UpnpService upnpService = new UpnpServiceImpl ();
RegistryListener registryListener = new PortMappingListener (desiredMapping );
upnpService .getRegistry ().addListener (registryListener );
upnpService .getControlPoint ().search ();
}
}
Special syntax:
To highlight a line (yellow background), prefix it with '@@'
To indicate that a line should be removed (red background), prefix it with '-'
To indicate that a line should be added (green background), prefix it with '+'
To post multiple snippets, seperate them by '~~~~'
ivj94
(584 views)
2018-03-24 14:47:39
ivj94
(48 views)
2018-03-24 14:46:31
ivj94
(382 views)
2018-03-24 14:43:53
Solater
(62 views)
2018-03-17 05:04:08
nelsongames
(109 views)
2018-03-05 17:56:34
Gornova
(159 views)
2018-03-02 22:15:33
buddyBro
(703 views)
2018-02-28 16:59:18
buddyBro
(92 views)
2018-02-28 16:45:17
xxMrPHDxx
(493 views)
2017-12-31 17:17:51
xxMrPHDxx
(733 views)
2017-12-31 17:15:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org