View previous topic :: View next topic |
Author |
Message |
bennie Rank: Super Veteran
Joined: 23 Dec 2004 Posts: 2043
|
Posted: Sat Dec 09, 2006 3:35 pm Post subject: Java Dreams |
|
|
Marilyn meets Martina.. and cancels all her appointments..
It is extremely rare that a classic beauty meets another classic beauty.
It did happen above !!
Enjoy your weekend Martina !!!
Oh ..and I miss you
--Bennie-- |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
MartinaWarren Official Model
![](images/avatars/gallery/moderator_only/martinawarren.jpg)
Joined: 22 Dec 2004 Posts: 5031
|
Posted: Mon Dec 11, 2006 8:15 am Post subject: |
|
|
Thats so cool Bennie, and i even have a Vodka Cranberry
I did enjoy my weekend, i hope you did also ![Cool](images/smiles/icon_cool.gif) _________________ Martina Warren - Official Website of the 2005 Penthouse Pet of the Year
http://www.martinawarren.com |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
bennie Rank: Super Veteran
Joined: 23 Dec 2004 Posts: 2043
|
Posted: Mon Dec 11, 2006 9:37 am Post subject: |
|
|
MartinaWarren wrote: | Thats so cool Bennie, and i even have a Vodka Cranberry
I did enjoy my weekend, i hope you did also ![Cool](images/smiles/icon_cool.gif) |
Thx Marfina !!
Glad you liked it !
--Bennie-- |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
marcus Rank: Super Veteran
![](images/avatars/gallery/More_1/GreatBritain.gif)
Joined: 25 Dec 2004 Posts: 1915
|
Posted: Tue Dec 12, 2006 3:38 pm Post subject: |
|
|
Bennie, this is what Java dreams look like:
import java.io.*;
import java.net.*;
import java.util.*;
import java.applet.*;
public class ChatServer {
public static void main(String[] args) {
ChatServer cs = new ChatServer();
cs.go();
}
public final static int DEFAULT_PORT = 2000;
public final static int DEFAULT_MAX_BACKLOG = 5;
public final static int DEFAULT_MAX_CONNECTIONS = 20;
public final static String DEFAULT_HOST_FILE = "hosts.txt";
public final static String DEFAULT_SOUND_FILE = "file:gong.au";
public final static String MAGIC = "Yippy Skippy";
private String magic = MAGIC;
private int port = DEFAULT_PORT;
private int backlog = DEFAULT_MAX_BACKLOG;
private int numConnections = 0;
private int maxConnections = DEFAULT_MAX_CONNECTIONS;
private String hostfile = DEFAULT_HOST_FILE;
private String soundfile = DEFAULT_SOUND_FILE;
private List<Connection> connections = null;
private AudioClip connectSound = null;
private Map<String,String> hostToStudentMap = null;
//
// Methods for the Connection class
//
String getMagicPassphrase() {
return magic;
}
String getStudentName(String host) {
return hostToStudentMap.get(host);
}
void sendToAllClients(String message) {
for ( Connection c : connections ) {
c.sendMessage(message);
}
}
void playMagicSound() {
if ( connectSound != null ) {
connectSound.play();
}
}
synchronized void closeConnection(Connection connection) {
connections.remove(connection);
numConnections--;
notify();
}
//
// Private methods
//
private void go() {
String portString = System.getProperty("port");
if (portString != null) port = Integer.parseInt(portString);
this.port = port;
String backlogString = System.getProperty("backlog");
if (backlogString != null) backlog = Integer.parseInt(backlogString);
String hostFileString = System.getProperty("hostfile");
if (hostFileString != null) hostfile = hostFileString;
String soundFileString = System.getProperty("soundfile");
if (soundFileString != null) soundfile = soundFileString;
String magicString = System.getProperty("magic");
if (magicString != null) magic = magicString;
String connections = System.getProperty("connections");
if (connections != null) maxConnections = Integer.parseInt(connections);
this.connections = new ArrayList<Connection>(maxConnections);
this.hostToStudentMap = new HashMap<String,String>(15);
System.out.println("Server settings:\n\tPort="+port+"\n\tMax Backlog="+
backlog+"\n\tMax Connections="+maxConnections+
"\n\tHost File="+hostfile+"\n\tSound File="+soundfile);
createHostList();
try {
URL sound = new URL(soundfile);
connectSound = Applet.newAudioClip(sound);
} catch(Exception e) {
e.printStackTrace();
}
// Begin the processing cycle
processRequests();
}
private void createHostList() {
File hostFile = new File(hostfile);
try {
System.out.println("Attempting to read hostfile hosts.txt: ");
FileInputStream fis = new FileInputStream(hostFile);
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
String aLine = null;
while((aLine = br.readLine()) != null) {
int spaceIndex = aLine.indexOf(' ');
if (spaceIndex == -1) {
System.out.println("Invalid line in host file: "+aLine);
continue;
}
String host = aLine.substring(0,spaceIndex);
String student = aLine.substring(spaceIndex+1);
System.out.println("Read: "+student+"@"+host);
hostToStudentMap.put(host,student);
}
} catch(Exception e) {
e.printStackTrace();
}
}
private void processRequests() {
ServerSocket serverSocket = null;
Socket communicationSocket;
try {
System.out.println("Attempting to start server...");
serverSocket = new ServerSocket(port,backlog);
} catch (IOException e) {
System.out.println("Error starting server: Could not open port "+port);
e.printStackTrace();
System.exit(-1);
}
System.out.println ("Started server on port "+port);
// Run the listen/accept loop forever
while (true) {
try {
// Wait here and listen for a connection
communicationSocket = serverSocket.accept();
handleConnection(communicationSocket);
} catch (Exception e) {
System.out.println("Unable to spawn child socket.");
e.printStackTrace();
}
}
}
private synchronized void handleConnection(Socket connection) {
while (numConnections == maxConnections) {
try {
wait();
} catch(Exception e) {
e.printStackTrace();
}
}
numConnections++;
Connection con = new Connection(this, connection);
Thread t = new Thread(con);
t.start();
connections.add(con);
}
}
Be afraid. Be very afraid ![Shocked](images/smiles/icon_eek.gif) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
bennie Rank: Super Veteran
Joined: 23 Dec 2004 Posts: 2043
|
Posted: Wed Dec 13, 2006 12:21 pm Post subject: |
|
|
lol Marcus !
..Let's Martna decide which she likes best
She might choose yours ..
Chris Consani is regarded as one of the greatest and most popular artists in modern history. He was born in Ottawa, Canada in 1951.
I read somewhere, in fact I have the neon added picture of Marilyn in my house..hence the inspiration
Some neon added examples:
http://www.memoriesoflove.com/chrisconsani.htm
--Bennie-- |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|