|
|
|
Wednesday, 13 July 2011 05:54 |
import java.io.*;
import java.net.*;
public class simpleServer
{
public static void main(String args[])
{
// Message terminator
char EOF = (char)0x00;
try
{
// create a serverSocket connection on port 9999
ServerSocket s = new ServerSocket(9999);
System.out.println("Server started. Waiting for connections...");
// wait for incoming connections
Socket incoming = s.accept();
BufferedReader data_in = new BufferedReader(
new InputStreamReader(incoming.getInputStream()));
PrintWriter data_out = new PrintWriter(incoming.getOutputStream());
data_out.println("Welcome! type EXIT to quit." + EOF);
data_out.flush();
boolean quit = false;
// Waits for the EXIT command
while (!quit)
{
String msg = data_in.readLine();
if (msg == null) quit = true;
if (!msg.trim().equals("EXIT"))
{
data_out.println("You sayed: "+msg.trim()+""+EOF);
data_out.flush();
}
else
{
quit = true;
}
}
}
catch (Exception e)
{
System.out.println("Connection lost");
}
}
}
If you will mention the most played multiplayer games, without a doubt say the tank trouble Read more: |
|
|
Thursday, 11 November 2010 06:25 |
prepare:
http://wvarner.blogspot.com/2008/05/installing-virtualbox-guest-additions.html
sudo mkdir /mnt/my_folder
sudo nano /etc/rc.local
Add line:
mount -t vboxsf -w -o uid=1000,gid=1000 my_shared_folder_name /mnt/my_folder
Save, quit. Reboot:
sudo reboot
 Read more: |
|
|
|
|
|
|