You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Herendi Kristóf Pál <he...@citromail.hu> on 2011/06/18 21:30:36 UTC

A Tomcat 6 Socket Server

To whom is reading this mail.

Hello,

For some time i have been learning some server technologies for my own
needs. I have tried PHP but the way its constructed or the way it handles
scripts for object oriented programing wasn't suitable for me. Java is more
the way i think of programing and that is why i thought to give a try on
Tomcat.

I have looked for books. Most or all of them covers only JSP, JSF or JDBC
but non of them covers TCP - socket communication in details such as the
ServerSocketFactory, the JSSEFactory or the ThreadPool. I could mention some
more issues when setting up a socket based application like SocketPermision.

I wrote this mail in hope for answers, guidance or best practice for writing
a Socket based application server for handling ByteArray communication.

Where can i get the knowlage? How can i get smarter?

Thank you in advence,
Herendi Kristóf Pál
Budapest, Hungary - 2011 June the 11th.

ps:

To give you some idea of what i was try to accomplish, here is a pseudo code
for a Java Socket Server:

// ServerMain.java
package Server;

import java.net.ServerSocket;
import java.net.Socket;

public class ServerMain {
    private NewConnections newConn;
    private LogedInUsers ConnMemb;
    private UserList userList;
    private CommunicationGroups ComGroups;


    public ServerMain(){
        userList = new UserList();
        ConnMemb = new LogedInUsers();
        newConn = new NewConnections();
        ComGroups = new CommunicationGroups();
        try{
           
            ServerSocket serevrSock = new ServerSocket(4444);
            Socket clientSocket;
            while(true){
            System.out.println("Server ready, waiting for a client...");
            clientSocket = serevrSock.accept();
            new ConnectionHandler(clientSocket, userList, newConn, ConnMemb,
ComGroups).start(); // extends Thread
            }
        }catch(Exception e){
            System.out.println("Server startUp error: "+e);
        }
    }
    public static void main(String args[]){
        new ServerMain();
    }
}

// ### END

Its simple.
I have spent some time to try to translate it for Tomcat but with out any
refference i couldnt find the way to make it work.

-- 
View this message in context: http://old.nabble.com/A-Tomcat-6-Socket-Server-tp31876599p31876599.html
Sent from the Tomcat - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: A Tomcat 6 Socket Server

Posted by Pid <pi...@pidster.com>.
Please don't cross post.


p