Genericservlet on a socket

Hi,
Is it possible to deploy GenericServlets that would listen on TCP/IP socket messages (without the Http GET line)? I need to write a servlet which listens on Sockets. As am totally new to Sockets am little confused. Can anyone help me on this.
As in the API doc for GenericServlet:
Defines a generic, protocol-independent servlet.

Hi,
Thanks for the reply.My requirement here is Client sends ASCII messages over TCP/IP. I need to capture this message.
Here i have two approaches. One is using sockets. But using Sockets means we need to take complete care of Threads. And second method is using Generic Servlet, as Generic servlet can listen on TCP/IP since it is protocal Independent. But am not finding any example as how to start with this approach. Can u help on this. And other method is Use socket to get the TCP/IP messages and forward it to Generic Servlet. But not sure about the advantages and disadvantages of this approach.
The one i posted was quite misleading i think.. Sorry.. This is the deatailed explanation. Can you please help me with this.

Similar Messages

  • GenericServlet on raw socket

    Hi,
              is ist possible to deploy GenericServlets that would listen on raw socket messages (without the Http GET line)?
              As in the API doc for GenericServlet:
              Defines a generic, protocol-independent servlet.
              Thanks,
              Juergen

    That's a pity. No chance of it getting implemented in WLS? I found this paper discussing the problem:
              An Approach Paper for Listener Architecture using Web Server
              http://dev2dev.bea.com/pub/a/2004/06/Approachppr.html

  • GenericServlet on JDeveloper

    Hi all,
    how i can execute a GenericServlet on Jdeveloper, I test a servlet inherited from HttpServlet and I don't have problems but when a try to connect to GenericServlet my clients objects can't connect to it.
    JDeveloper display me a java.io.FileNotFoundException error.
    I use the same parameters (URL string, etc) for all test, the only thing that I change was that one is HttpServlet and other is GenericServlet.
    thansk for advise

    Hi,
    Thanks for the reply.My requirement here is Client sends ASCII messages over TCP/IP. I need to capture this message.
    Here i have two approaches. One is using sockets. But using Sockets means we need to take complete care of Threads. And second method is using Generic Servlet, as Generic servlet can listen on TCP/IP since it is protocal Independent. But am not finding any example as how to start with this approach. Can u help on this. And other method is Use socket to get the TCP/IP messages and forward it to Generic Servlet. But not sure about the advantages and disadvantages of this approach.
    The one i posted was quite misleading i think.. Sorry.. This is the deatailed explanation. Can you please help me with this.

  • Reading from a non-HTTP socket in WL; same idea as WL.system.listenPort

    Hi Fellow EJBers,
    I have a system which must listen on a TCP port that is not the normal
    WebLogic port nor the standard HTTP port for client connection
    requests. Unfortunately, the protocol is low-level TCP/IP sockets and
    as it's coming from a legacy system I cannot change. What I'd like to
    do is create a startup class in the EJB server that listens to the
    correct port and then hands off the socket ID to a bean for further
    processing. Then when the response is ready I can use a simple socket
    write() method.
    I am hoping that this will allow me to use WebLogic's built-in threading
    support in this class. I was hoping to find some way to imitate the
    WebLogic properties file entry
    weblogic.system.listenPort=7001
    but I didn't see any references to it in the documentation. Can I use a
    servlet or startup class to do this? I don't want to use events if I
    can help it to maintain compatibility. Alternatively, I'm thinking
    about using a separate Java process running in a different JVM which
    would manage the threading issues. This is less desirable because it
    complicates sending responses back and I don't know if I can pass the
    socket reference into EJB.
    Note that right now I'm only worrying about the listening portion, I
    must also send requests out to different machines but here I control the
    initiation.
    Thanks for any and all help,
    Terry ([email protected])

    Rob,
    Could you please explain why you should not create worker threads in the server.
    I created a GenericServlet and installed it in the ServerClasses so it does not
    ever get more than one instance - it listens on a server socket (in a thread) and
    accepts connections and allows replies to the
    connected socket. I use it for debugging where you connect to the port with Telnet and
    each developer that wants to output a debug string from a JSP back to their Telnet can
    do so. It works fine.
    I don't want to screw the server up so please enlighten me.
    Joe
    Rob Woollen wrote:
    If you have a legacy system that is sending data over TCP/IP sockets, you have
    to have a socket for it somewhere. It's certainly not an ideal situation since
    WebLogic already provides these basic services for you, just not for an arbitrary
    protocol.
    You definitely should not create worker threads in the server. Use WebLogic
    events or JMS instead.
    -- Rob
    Rob Woollen
    Software Engineer
    BEA WebLogic
    [email protected]
    Russell Castagnaro wrote:
    Rob,
    Is it OK to start your own threads that listen on a particular port? I've been
    informed over and over again that this is a recipe for disaster. If it is
    acceptable to start up a port listener thread at some times, when is it
    acceptable and when isn't it? (I know not to do it with Servlets or EJB's)
    Thanks in advanced..
    Russell
    Rob Woollen wrote:
    Hi.
    Terence Davis wrote:
    Hi Fellow EJBers,
    I have a system which must listen on a TCP port that is not the normal
    WebLogic port nor the standard HTTP port for client connection
    requests. Unfortunately, the protocol is low-level TCP/IP sockets and
    as it's coming from a legacy system I cannot change. What I'd like to
    do is create a startup class in the EJB server that listens to the
    correct port and then hands off the socket ID to a bean for further
    processing. Then when the response is ready I can use a simple socket
    write() method.
    Okay, that seems reasonable. Note, that EJB 1.1 (the next version of
    the spec) prohibits bean writers from directly reading or writing sockets.
    I am hoping that this will allow me to use WebLogic's built-in threading
    support in this class. I was hoping to find some way to imitate the
    WebLogic properties file entry
    weblogic.system.listenPort=7001
    but I didn't see any references to it in the documentation.I'm not sure that I follow. You could use your own properties file if
    you want to configure a listen port for your socket.
    Can I use a
    servlet or startup class to do this? I don't want to use events if I
    can help it to maintain compatibility.JMS (available in 4.5.x) is a J2EE standard tha has a superset of the
    events functionality.
    Alternatively, I'm thinking
    about using a separate Java process running in a different JVM which
    would manage the threading issues. This is less desirable because it
    complicates sending responses back and I don't know if I can pass the
    socket reference into EJB.
    Note that right now I'm only worrying about the listening portion, I
    must also send requests out to different machines but here I control the
    initiation.
    Thanks for any and all help,
    Terry ([email protected])
    Russell Castagnaro
    Chief Mentor
    SyncTank Solutions
    http://www.synctank.com
    Earth is the cradle of mankind; one does not remain in the cradle forever
    -Tsiolkovsky

  • Problem with socket and Threads

    Hi,
    I have coded a package that sends an sms via a gateway.
    Here is what is happening:
    * I create a singleton of my SMSModule.
    * I create an sms object.
    * I put the object in a Queue.
    * I start a new Thread in my sms module that reads sms from queue.
    * I connect to sms gateway.
    * I send the sms.
    * I disconnect from socket! This is where things go wrong and I get the following error (see below).
    I have a zip file with the code so if you have time to take a look at it I would appreciate it.
    Anyway all hints are appreciated!
    //Mikael
    GOT: !LogoffConf:
    mSIP Kommando var: !LogoffConf
    CoolFlix log: MSIPProtocolHandler;setLoggedin(false)
    We got LogOffConf
    Waiting ......for thread to die
    java.net.SocketException: Socket operation on nonsocket: JVM_recv in
    socket input stream read
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:116)
    at
    sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:405)

    Off the top of my head, probably the garbage collector cleared your SMSModule coz all classes loaded through other classloaders will be unloaded when that classloader is unloaded.
    mail in the code if you want me to look at it with greater detail.

  • Can i use the same socket to connect to more than one servers

    hi,
    I'm new to java. I want to know whether a socket created using Socket() constructor can be used to connect to multiple servers, not necessarily at a particular point of time. ie, i want to connect to various servers using a single socket and register some info abt them, possible using a loop, one by one. I use connect() method to connect to particular server.
    In other words is Socket class is mutable.
    Edited by: itsraja on Feb 25, 2008 5:50 AM

    In short, I don't think so.
    Setting the server name for a socket is in the constructor.
    Socket s = new Socket("localhost", 501);I don't believe that there are any functions, such as:
    s.setHost("localhost");
    s.setPort(501);However, JavaDocs suggests that when you use the no-args constructor, your class becomes an automatic SocketImpl class, but you can't reach any of its variables unless you derive from the class, itself. But that's probably a bigger headache than it's worth.
    Now TECHNICALY, if you didn't want to create a new variable, you could use:
    Socket s = new Socket("localhost", 501);
    s.close();
    s = new Socket("remotehost", 502);
    s.close();However, this is still creating a new instance and thus a new object in memory.
    I hope this answers your question.
    Let us know exactly what you're trying to do for a more exact answer.
    ~Derek

  • My iPod Touch will no longer charge from a wall socket, only my computer. HELP!

    My 4th generation iPod Touch will no longer charge from a wall socket, only my computer. I tried buying a new cable and USB charging socket (and I bought one made by Apple), but that did not fix the problem. I restored it from iTunes, hoping that would work as well, but that failed. I am at my wit's end. Can anybody here help me? I've bought new equipment, tried rebooting, restoring, etc. but nothing so far has proven successful. If anyone's got a solution, please help!
    Thanks!
    Signed, a very frustrated iPod user in Ohio!
    <Edited By Host>

    All I can suggest is the standared fixes. It seems very strange
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.             
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem. Bring the cable and Apple wall charger too.
    Apple Retail Store - Genius Bar                                      

  • MSI K7N2 Delta-ILSR Nforce2 (Socket A) Motherboard (MB-003-MS) Features NF2 chip

    I tried to install 3 of the Crucial Ballistix Tracer (1 Gig Each) in this motherboard (MSI K7N2 Delta-ILSR Nforce2 (Socket A) Motherboard (MB-003-MS) Features NF2 chipset) and it will not run stabilly no matter what I tried. Is this a bios conflict with the memory? If so, are there any new bios updates? I have tried cas settings and voltage settings but nothing works. It will how ever run perfectly with only 2 sticks in single channel mode. It will not run same 2 sticks in dual channel mode. Anyone have any ideas? Anyone know of any new motherboards with maybe NFORCE 4 Chipset that support all 3 sticks of this memory and an AGP graphics card? Im thinking of a new motherboard but I still need to have AGP and SATA.
    Barton 3200 core proc.
    System has ran fine for a solid year until I tried new memory. Please help!

    Quote from: freakytiki4u on 07-November-06, 23:42:33
    Ok I tried to use relaxed FSB by -10 and relaxed mem timings but still unstable due to the motherboard trying to use dual channel memory. If you can modify the bios to where it will not have the capability of dual channel memory I truly believe it will work. Will u try this for me? I would greatly appreciate it as I am really not ready to spend all the money on new equipemtn when this suits my needs for now.
    sure but as i said before this is gona be experimental and risky. Here we go:
    MSI K7N2 Delta ILSR Experimental MOD E1(Disable Dual CH ability)
    Procedure is automated in best possible safest way to BIOS update.
    Prepare a blank diskette in a good condition(newest one etc.)
    ]execute file under XP will make bootdisk with automated BIOS update procedure. when diskette is ready, reboot PC and boot from FDD(floppy), wait a bit, then you will be asked for final confirmation about BIOS update process, press a key to proceed, after BIOS update is complete, ensure that you got successfully output message from flash program. then power down your PC, remove power cord from the PSU, hit power button several time to drain caps electrify, touch with hands some metal for ES discharge, and Clear CMOS.
    pull back power cord, power up your PC, when you see CMOS checksum error,(expected msg) hit F1 to continue to re-build DMI pool data, then reboot and enter in BIOS, LOAD BIOS DEFAULT, and SAFE AND EXIT.
    NOTE: Ensure your PC is stable before proceed with BIOS update.
    NOTE: Use it at own risk, chance of failure is big, cannot guarantee results and safest as provisional mode which can guarantee it will work stable with features. also cannot test it personally before give you. (don't have mobo anymore)
    Using it may end with dead mainboard (BIOS chip re-flash will be required, if somethink goes wrong)

  • When I try to log on to my ichat I get the error message "An undefined AIM socket error has occurred.". How do I resolve this?

    The error message "An undefined AIM socket error has occurred." comes up when I try and log on to ichat.

    I have the same issue. Does anybody know why this has happened

  • Assign unique id to client of socket server

    HI
    I am in the process of developing a xml socket server application and have hit on a problem. I have managed to create a server that listens for connections and once a request is recieved creates a new client on a seperate thread with the reference being stored in a vector in the server.
    However I want to be able to assign an id to a client when it is created so that I can broadcast messages to specific users.

    my apologies my question was poorly stated..
    When i meant unique i mean that they will have already been prdefined i.e for example the following users
    Name David
    UserId *(Unique) 0138868
    Name sarah
    UserId *(Unique) 4138868
    Name rob
    UserId *(Unique) 7138868
    what i want to be able to is when the users connect they can be refeneced by their Userid so that if rob wants to say something to sarah without david knowing. The problem I have is that I do not know how to provide the userid to the server such that the server can create a new client thread with a specified id.
    Hope that makes sense ;>

  • Data written to socket getting lost?  or perhaps out of order?

    I'm trying to fix a bug in Flashmog. The bug is described in more detail here.
    Basically what is happening is that my Flash client claims that it is calling functions that don't arrive at the server -- or they arrive, but the socket data is out of order and therefore is garbled.  I've stared at the source code for hours and tried a lot of trial-and-error type stuff and added trace statements to see if I can find the problem and I'm not having any luck.
    In particular, there's class I have called RPCSocket that extends the AS3 Socket class so I can serialize data structures before sending them across a socket.  At one point, this RPCSocket class calls super.writeBytes and super.Flush.  It is the point at which I send all data out of my client. The data is binary data in AMF3 format.
              public function executeRPC(serviceName:String, methodName:String, methodParams:Array):void {
                   if (!this.connected) {
                        log.write('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' + serviceName + ' while not connected', Log.HIGH);
                        throw new Error('RPCSocket.executeRPC failed. ' + methodName + ' attempted on service ' + serviceName + ' while not connected.');
                        return;
                   var rpc:Array = new Array();
                   rpc[0] = serviceName;
                   rpc[1] = methodName;
                   rpc[2] = methodParams;
                   var serializedRPC:ByteArray = serialize(rpc);
                   if (!serializedRPC) {
                        log.write('RPCSocket.executeRPC failed.  Serialization failed for method ' + methodName + ' on service ' + serviceName, Log.HIGH);
                        dispatchEvent(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, 'RPCSocket.executeRPC failed.  Serialization failed for method ' + methodName + ' on service ' + serviceName));
                   super.writeUnsignedInt(serializedRPC.length);
                   super.writeBytes(serializedRPC);
                   super.flush();
              } // executeRPC
    Can someone recommend a way for me to store without corruption, conversion, or filtering or translation of any kind *all* of the information sent across this socket? I'd like to write it to a file.  I'm guessing that keep a global ByteArray var and storing the info there might work, but I'm wondering how I might get the contents of that ByteArray into a file so I can inspect it.
    Also, I'm wondering if I might be able to inspect what flash actually sends out on the socket?  I have a sneaking suspicion that data I supply to super.writeBytes may be sent out of order or may not actually get sent across the socket.  This bug I'm talking about only seems to happen under high-stress situations when I'm sending dozens of messages per second across this one socket.

    oops...forgot link to bug description: http://flashmog.net/community/viewtopic.php?f=5&t=549

  • Socket connect slow in JDK 1.5?

    We recently began testing our Java Swing application with JDK 1.5, and we noticed that socket.connect()
    calls are taking several seconds to return, when before in 1.4 the calls returned immediately.
    Here is some sample code:
    Socket sock = new Socket();
    InetSocketAddress sockAddr = new InetSocketAddress(inAddress, portNum);
    sock.connect(sockAddr, 2000);
    What could be wrong? I've debugged the code and verified inAddress is an IP address,
    not a hostname.
    -Eric

    Here is the list of enhancements in JDK1.5.
    http://java.sun.com/j2se/1.5.0/docs/guide/net/enhancements-1.5.0.html
    I wonder if any of them are having some effect in the slow connection.
    There are some network properties that you can tweak with. Did you try them?
    Here is the list
    http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html

  • Iphone 4 headphone socket not working headphones won't go all the way in

    My iphone 4 headphone socket not working, the headphones won't go all the way in? any help, ideas?

    I bough a new ipad two a few feels ago and still haven't managed to used any headphones with it.
    It's very annoying as I'm currently in hospital and will be for a few more weeks and this being the reason I bought it!! Now I have to have it on very low volume and not use it in the evening  

  • IPhone 4 ear speaker not working after 2 restores and cleaning the headphone socket.

    Hi,
    I know this problem is not uncommon, but here goes...
    I have an iPhone 4 which was running iOS 5.1.1 a few days ago when the ear speaker stopped working.  I cant hear the other person when I make or recieve a call, but nothing else is wrong with the phone.  It is 18 months old.
    I've searched the discussions and seen some of the suggestions.  I tried cleaning out the headphone socket, with no luck.  I then tried a full restore and update to iOS 6.  This appeared to have worked.  I tried 2 calls and I could hear the other person.  I then left the phone alone for a couple of hours and when I tried it again, it had stopped working again.
    I have since done another full restore but the speaker is still not working at all.  The fact that it worked after the first restore suggests it's something simple or software related but I have no idea what else to try other than getting it repaired in a shop.  The problem is I am in Japan where my network (Softbank) and an independent repair shop have both quoted me the equivalent of $176 / £110 to fix it.
    Does anyone know anything else I can try before I give in and end up shelling out this ridiculous cost for something that is probably a 20 minute fix?
    Any help would be appreciated.
    Thanks

    I have the exact same problem with my ear speaker after my IOS 6 upgrade. My speakers work, bluetooth works, the earphones work, but the ear speaker doesn’t work. I noticed this IMMEDIATELY after the upgrade was completed. I also have the following problems:
    -Very slow call connect time. 30 - 45 seconds just to connect is typical. Signal strength is 5 bars (ATT)
    -Problems attaching to known networks
    -Very slow internet browsing with many timeouts on both the ATT 3G service and known Wi-Fi networks.
    - My camera was missing after the IOS 6 upgrade. I restored that from Restrictions inside of the Settings App
    - Music was so screwed up it was easier to just restore it
    I went to the Apple store hoping to get some support. Between my wife, my son, and myself we have purchased 4 iPhones and an iPad over the last few years with plans to purchase another iPad in a month or so. So it’s not like I' not familiar with Apple Technology and their typical level of support.
    The individual who waited on me was rude and condescending. He insisted that all of the problems were hardware related or ATT’s fault, or my fault. He further asserted that IOS 6 had NOTHING to do with any of the problems. I pointed out that it would be quite a coincidence for my hardware to break, for ATT to have network problems, and for me to suddenly forget how to use an iPhone at the same exact moment that IOS 6 had been installed. He maintained his position and offered to sell me another phone.
    I don’t expect the folks in the store to reprogram the OS. Mistakes happen. I’m going to guess that Apple’s OS programmers are already working on a fix for many of the IOS 6 complaints that are easy to find on Google. Assigning blame to the customer and denying any responsibility is not a model for success or customer service. I’m sure Apple wouldn’t accept that kind of excuse from their component manufacturers and don’t think it is how they should deal with their customers. Further, Apple wants to own the device. They want to control the apps, the OS, battery, the delivery channel. I’m good with that so long as when there is a problem, they own that as well.
    And BTW… I’m not including the maps in my list of issues with IOS 6 because I kind of like the new maps and am willing to give Apple the benefit of the doubt. I believe that their map service will get a lot better in a hurry.

  • K8neo 4 socket 939 cpu 3800 x2 amd what is the best hard disk

    k8neo 4 socket 939 cpu 3800 x2 amd what is the best hard disk
    for this confy
    i know maxtor has more problem
    so i ask to you
    what is the best hard disk 250 300 gb ?
    sata sata 2 ?
    i read about in some site but i can understand what is the best for this confy
    thank
    my english is Lol

    When we are talking about Quality and Performance the choice is:
    http://www.wdraptorx.com

Maybe you are looking for