[jboss-user] [Remoting] - Re: Simple Socket Server (TEXT)?

cazuza do-not-reply at jboss.com
Tue Jul 10 03:35:32 EDT 2007


Appologies in advance if the questions are too naive, but I'm just starting with Jboss and have a head full of doubts.

I have try to implement a socket server using this approach and have hit a wall.
the timeout attribute works but doesn't close the socket instead it sends error messages to the console.

16:05:52,492 ERROR [STDERR] java.net.SocketTimeoutException: Read timed out
16:05:52,492 ERROR [STDERR] 	at java.net.SocketInputStream.socketRead0(Native Method)
16:05:52,492 ERROR [STDERR] 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
16:05:52,492 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
16:05:52,493 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
16:05:52,493 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
16:05:52,493 ERROR [STDERR] 	at java.io.InputStreamReader.read(InputStreamReader.java:167)
16:05:52,493 ERROR [STDERR] 	at java.io.BufferedReader.fill(BufferedReader.java:136)
16:05:52,493 ERROR [STDERR] 	at java.io.BufferedReader.readLine(BufferedReader.java:299)
16:05:52,493 ERROR [STDERR] 	at java.io.BufferedReader.readLine(BufferedReader.java:362)
16:05:52,493 ERROR [STDERR] 	at com.thetote.dbi.socket.TextUnMarshaller.read(TextUnMarshaller.java:53)
16:05:52,493 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.versionedRead(ServerThread.java:652)
16:05:52,493 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:530)
16:05:52,493 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:383)
16:05:52,493 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
16:05:57,492 ERROR [STDERR] java.net.SocketTimeoutException: Read timed out
16:05:57,493 ERROR [STDERR] 	at java.net.SocketInputStream.socketRead0(Native Method)
16:05:57,493 ERROR [STDERR] 	at java.net.SocketInputStream.read(SocketInputStream.java:129)
16:05:57,493 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:411)
16:05:57,493 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:453)
16:05:57,493 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:183)
16:05:57,493 ERROR [STDERR] 	at java.io.InputStreamReader.read(InputStreamReader.java:167)
16:05:57,493 ERROR [STDERR] 	at java.io.BufferedReader.fill(BufferedReader.java:136)
16:05:57,494 ERROR [STDERR] 	at java.io.BufferedReader.readLine(BufferedReader.java:299)
16:05:57,494 ERROR [STDERR] 	at java.io.BufferedReader.readLine(BufferedReader.java:362)
16:05:57,494 ERROR [STDERR] 	at com.thetote.dbi.socket.TextUnMarshaller.read(TextUnMarshaller.java:53)
16:05:57,494 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.versionedRead(ServerThread.java:652)
16:05:57,494 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:530)
16:05:57,494 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:383)
16:05:57,494 ERROR [STDERR] 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)

unless the client closes the connection itself it seems that the server will timeout and write error messages to STDERR. I don't want to rely on the client to close the connection, is it possible to close the socket connection after sending the response?

the other question is How do I send multiple messages back to the client. At the moment on my invoke method I receive the request, parse it and return a string, what do I have to do to send another string without concatenating on the previous string?

this is my config file


	<!-- ==================================================================== -->
	<!-- Invokers to the JMX node                                             -->
	<!-- ==================================================================== -->
   <mbean code="org.jboss.remoting.transport.Connector"
          name="com.xxxx:service=Connector,transport=socket"
          display-name="RacingDB Socket transport Connector">
      
         
            
               5000
               text
               com.xxxx.dbi.socket.TextMarshaller
               com.xxxx.dbi.socket.TextUnMarshaller
               com.xxxx.dbi.socket.SimpleInputStreamWrapper
               ${jboss.bind.address}
               6193
               true
            
            
               com.xxxx.dbi.socket.Handler
            
         
      
   



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4062263#4062263

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4062263



More information about the jboss-user mailing list