This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
yes, i want to know which API to use ,currently i am having a servlet which is listening to a particular url to be hit and then do whatever needed,but it is listening for http requests only if some body do ssh on that server then what should i do?
is there any other way of detection?
To listen for SSH requests without creating a server socket on the SSH port (which you can't because there's already the SSH server running on it), you will probably need to interact with the network interface on a low level. Pure Java can't do that, so you'll either have to use JNI to write something yourself or use a third party library that has already implemented this. I think jpcap is a suitable library, but I haven't tested it myself.
ya that is true i cant create a socket on 22 port as ssh already running on that port but isn't it possible to redirect ssh request to another port where i can create socket process it here and the redirect it back to port22 ?
You could write your own raw proxy. In short:
- create a ServerSocket on port 22
- upon an incoming connection, create a Socket to the SSH server (on a different port)
- copy all data from the incoming Socket to the SSH Socket and vice versa