Mat Matthew

Greenhorn
+ Follow
since May 07, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mat Matthew

Just for clarification, for the code below
// Server is listening to port 2223
ServerSocket server = new ServerSocket(2223);
//accepting the client request on the given port(2223)
Socket client = server.accept();

This 'client' socket has two ports associated with it, thats my understanding one local port and one remote port. Remote port is the port on the client. The local port on the server is 2223 or some other port?? What I understood from sun's explanation is, this port is different from port 2223 ??

Thanks
[ May 08, 2005: Message edited by: Mat Matthew ]
Hi folks,
New to socket programming here. Please ignore if its too stupid. In sun site for What is a socket ?

On the client-side: The client knows the hostname of the machine on which the server is running and the port number to which the server is connected. To make a connection request, the client tries to rendezvous with the server on the server's machine and port. If everything goes well, the server accepts the connection. Upon acceptance, the server gets a new socket bound to a different port. It needs a new socket (and consequently a different port number) so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client.

<<<<<<
But if we print out the port number of the socket side on the server, we get the same port number we requested the connection. I mean upon acceptance of the request from client, the server does not bind the socket to a new port. The socket is still bound with the orginal port on the server. Could some body explain please?

Thanks in advance
Mat
[ May 08, 2005: Message edited by: Mat Matthew ]
Hi folks,
New to EJB here.I am trying to run the AdviceClient problem from HeadFirst EJB book and I am getting a ClassCastException with the following code. I was able to deploy the bean and I am trying to run the client test from command line.

Context ic = new InitialContext();
Object o = ic.lookup("Advisor");
**** AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o,AdviceHome.class);
Advice advisor = home.create();
System.out.println(advisor.getMessage());


I am getting exception on the line PortableRemoteObject.narrow......



In other words how do I
1.Select the service provider of the corresponding service I want to access.
2.Specify any configuration that the initial context needs.

I am trying to run a client from command line in order to test a stateless session bean as given in HeadFirstEJB ( AdviceClient.java)

I am using j2sdkee1.3.1 from Sun.

Thanks in advance
Matt
[ May 07, 2005: Message edited by: Mat Matthew ]