TCP Socket Reading Problem-

Hi,
I am reading a response from the Socket by using InputStream and BufferedReader object. Reading it byte by byte. But as my response data ( bytes) is very large (6000- 7000 bytes). The reading time is almost 5-6 minutes.
As i dont know the socket inputstreams size ( no of bytes) i can't use readFully() method of DataInputStream becoz byte array size is to be specified . If the array size > reponse size, it throws EOF exception,
So my problem is that reading the response should be fast . Can you please tell any way of reading the response fast or knowing the socket inputstreams size in prior before reading it .
Awaiting your reply,
Regards,
Prakash.

balramprakash wrote:
Hi,
I am reading a response from the Socket by using InputStream and BufferedReader object. Reading it byte by byte. BufferedReaders read text (16-bit char) not bytes.
But as my response data ( bytes) is very large (6000- 7000 bytes). This isn't very large unless you network is very slow. Even with 1 Mb broadband this would take 0.07 seconds to download. On a dial modem it would take 1.5 second.
The reading time is almost 5-6 minutes. You have a serious problem with your setup. Even reading one character at a time (which is the slowest way to do this) it shouldn't take anywhere near that long.
Perhaps you don't know when the response ends so you ware waiting for a disconnect or the connection to timeout.
As i dont know the socket inputstreams size ( no of bytes) i can't use readFully() method of DataInputStream becoz byte array size is to be specified If you can change the format, you can send the size before you send the data and the reader know how much data to expect.
So my problem is that reading the response should be fastSend the size with the response. Don't use BufferedReader if you have binary data. (e.g. byte data) It it should take about 7 ms to load on a 10 Mb connection.
BTW: if you are opening a new connection each time it can take about 20 ms to establish, so the time to download the response is small in this case.

Similar Messages

  • Socket reader problem even if Native IO is enabled

    Hi,
    I am using weblogic 6.1 sp1 on a hp windows2000 quad box. weblogic server hosts
    all the ejbs. Resin is used as a servlet engine. Sometimes the message
    <Sep 10, 2001 8:35:01 PM CDT> <Warning> <JavaSocketMuxer> <There are: '3' active
    sockets, but the maximum number of socket readers allowed by theconfiguration
    is: '2', you may want alter your configuration.>
    is seen in resin log.
    I thought this should not happen if NativeIO is enabled. I am sure nativeIO is
    enabled because when weblogic startup , I am able to see the PerformancPack tag.
    thanks
    arock

    This is a client-side configuration. You can increase WLS thread pool size by
    setting these 2 system properties (if I remember their names correctly):
    weblogic.ThreadPoolSize=10
    weblogic.ThreadPoolPercentSocketReaders=60
    on the client side.
    arock <[email protected]> wrote:
    Hi,
    I am using weblogic 6.1 sp1 on a hp windows2000 quad box. weblogic server hosts
    all the ejbs. Resin is used as a servlet engine. Sometimes the message
    <Sep 10, 2001 8:35:01 PM CDT> <Warning> <JavaSocketMuxer> <There are: '3' active
    sockets, but the maximum number of socket readers allowed by theconfiguration
    is: '2', you may want alter your configuration.>
    is seen in resin log.
    I thought this should not happen if NativeIO is enabled. I am sure nativeIO is
    enabled because when weblogic startup , I am able to see the PerformancPack tag.
    thanks
    arock--
    Dimitri

  • HttpConnection & TCP Sockets

    I wish to receive an httprequest on a tcpsocket. That is one midlet opens an httpconnection and the other midlet opens a tcp socket. Is it posiible for two way communication between them.
    If so how can the tcp socket read the data.

    Hi Briggsd!
    I'm playing with some sockets.
    can you please help me?!
    J2ME uses only HTTP connections?
    and what are the sockets? what is the difference between CLDC socket and J2SE Socket?
    is there any other way to communicate with a Servlet?
    and very important..
    is there a difference if it's using GPRS or 3G?
    would the http connection work for all? and just the connection speed would change?
    help me!!

  • Problems sending files throught TCP sockets

    I would like to transfer a file throught a tcp socket, here there is what the sender program does :
    try{
         File localFile = new File("shared/"+fileName);
         DataOutputStream oos = new DataOutputStream(socket.getOutputStream());     
         DataInputStream fis = new DataInputStream(new FileInputStream(localFile));
         while(fis.available() > 0){
              oos.writeByte(fis.readByte());
         catch(Exception e){}here what the receiver program does:
         try{
         File downloadFile = new File("incoming/"+fileName);
         downloadFile.createNewFile();
         ois = new DataInputStream(connectionSocket.getInputStream());
         fos = new DataOutputStream(new FileOutputStream(downloadFile));
         while(ois.available() > 0){
              fos.writeByte(ois.readByte());
         catch(Exception e){}
    }Where i m wrong? it doesnt work :( , it just create the new file in the incoming folder, but its size remains 0 byte :(
    help a newbye please :D

    Your problem is probably related to the use of available. This is the amount that is currently in the buffer that you can read without blocking. For network programming you should expect to have to wait for data. Second, you are copying the data one byte at a time which is not very efficient. Try something like:
    // Sender
    try {
        File localFile = new File("shared/"+fileName);
        OutputStream out = socket.getOutputStream();     
        InputStream fis = new FileInputStream(localFile);
        int length;
        byte[] buffer = new byte[4096];
        while((length = fis.read(buffer)) != -1)
         out.write(buffer, 0, length);
        fis.close();
        out.close();
    catch(Exception e){}
    // Receiver
    try {
        File downloadFile = new File("incoming/"+fileName);
        IntputStream ois = connectedSocket.getIntputStream();     
        OutputStream fos = new FileOutputStream(downloadFile);
        int length;
        byte[] buffer = new byte[4096];
        while((length = ois.read(buffer)) != -1)
         fos.write(buffer, 0, length);
        fos.close();
        ois.close();
    catch(Exception e){}

  • Socket read error: connection reset by peer

    Hi.
    Has anybody experienced the error message �Socket read error: connection reset by peer�
    Please see below for detailed information.
    Appreciate your help
    Regards
    RT
    Enviroment specification
    Server: HP/UX 11.00 64-bit, Oracle RDBMS 8.1.6.0.0 64-bit
    2 firewalls between client and db.
    Client:
    Win 2000,
    SP3,
    Oracle Client 8.1.7.0.0 ,JDBC OCI (thin JDBC driver,class12.zip)
    JDK 1.3
    JRUN3.0
    The TCP protocol is being used in the communication
    Error messages
    Web Users receive:           Socket read error: connection reset by peer
    Trace files on the sever:      Read unexpected EOF ERROR on 18.
    Explanation: The error in the server sqlnet trace file, suggests that a client connection has terminated abnormally, i.e. client machine powered off, a cable removed or a network connection aborted without warning. No user has complained of such a problem and there is no client trace with an error.
    The problem
    The users of the java web application, experiencing an exception almost once or twice a day.
    The JRUN web-server reports broken connections to the db and client are receiving "connection reset by peer".
    At the moment when the errors occurs the users just have to wait a while(2-10 min) and then they can use the web application again.(no action is taken)
    This problem can not be reproduced. The problem happens only occasionally when the network is under heavy load and new DB connection is being created.
    The application
    The java web-application uses a customized connection pooling against the database. This pool is shared among all the users of the website. whenever a user process needs to fetch data from the database, a free connection from this pool is allocated. The application is testing if the connection is valid before making a transaction (select '1' from dual). When the error occurs a ORA-3113 end-of-file on communication channel is returned to the application.
    The path between the client and db involves at least two firewalls. The firewalls are opened for sql*net traffic. The network group can tell that enquiries from the app.server is not getting feedback from the db. They have not however, identified if the enquiries are reaching the db-srever, or if they are stopped earlier in the network.
    Around 1000 users, are using other applications which uses dedicated sqlnet connections against the db and they have not experienced any problems.
    Issues considered
    Connection pooling
    It is a customized connection pooling, developed by Lindorff developers.
    I have read through the source code for the connection pooling and it does the job as it should, and in case of bad connection, it tries to create a new connection.
    The log file shows that the call to the method DriverManager.getConnection() hangs until the server goes down, which is probably because of the fact that the method DriverManager.setLoginTimeout(), does not take effect and timeout value is Zero. ( According to oracle , Oracle JDBC does not support login timeouts and calling the static DriverManager.setLoginTimeout() method will have no effect).
    Firewall
    One thing to consider is when the firewall may decide to shut down the socket due to long inactivity of a connection. This will cause problems to JDBC Connection Pool because the pool is not aware of this disconnection at the TCP/IP level; until someone checks out the connection from the pool and tries to use it. The user will get a Socket read error: connection reset by peer.
    Jrun timeout paramter is less than the firewall�s timeout so the firewall will not close a connection before Jrun does.
    Number of processes the DB can handle
    Processes parameter is 1300, , they have not experienced the Oracle error msg �max # of processes reached�.
    Port redirection through a firewall:
    Since the firewall has a sql net proxy Port redirection through a firewall is not a problem. Problems with port redirection only appear at connect time, but in this situation the connections fail long after the connection is established.
    The network group
    The network people who investigaged the problem at Lindorff report that there are a significant amount of "dropped packages" between the database server and the jdbc client (web-application) 24 hrs. The reason for this is "unknown established TCP packet" which means that the firewall does not consider these packages to be part of an already established session. The network group believes this happen because one of the hosts send a RESET or FIN signal which the firewall have noticed but are not received by the other host.
    It seems like the firewall are dropping packages bacause of "Unknown
    established TCP packet" from both the JDBC client and the TNSLISTENER on the database server. The dropped packages are SQL*Net v2 traffic so clearly Oracle products are involved

    Presumably something is working.
    Thus the problem is not with your code. At least not the database part that you have control over.
    That error occurs when the other side closes the socket. Presumably you are catching lost connection exceptions and trying to restore it.

  • TCP Socket connection in CLOSE_WAIT status and not getting closed

    I am facing an issue with the TCP socket connections not getting closed and they are in CLOSE_WAIT status for ever.
    As a part of batch process in our application, emails are sent with 4 embedded images. These images are downloaded from 3rd party site with IP say "UUU.XXX.YYY.ZZZ"
    The images are embedded to email as follows
    1. An URL object is created with the site url.
    URL urlPhoto = new
    URL("http://UUU.XXX.YYY.ZZZ/email/photos.jpg");
    2.     The image cid is created with the URL object and the image name
    HtmlEmail htmlEmail = new HtmlEmail();
    String cid1 = htmlEmail.embed(urlPhoto,
    "photo.jpg");
    3.     The image cid is added to the email template by replacing the ${cid1} and the email is sent.
    <td valign="top">
                   <img src="cid:${cid1}" width="279" height="274">
              </td>
    When a mail is sent, 4 new TCP connections are opened and are put in CLOSE_WAIT status for ever. For every mail sent 4 new connections are opened. In UNIX there is an upper limit on the number of open file handles (defaults to 1024) at any point of time. The open TCP connection has the underlying socket in CLOSE_WAIT status and is not getting closed at all. When the upper limit (1024) is reached the batch process is throwing the following exception and terminates.
    Caused by: com.inet.tds.ap: java.net.SocketExceptionjava.net.SocketException: Too many open files
    at com.inet.tds.am.a(Unknown Source)
    at com.inet.tds.TdsDriver.a(Unknown Source)
    at com.inet.tds.TdsDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at com.hcomemea.batchprocess.dataaccess.database.BaseJdbcDao.openConnection(BaseJdbcDao.java:106)
    ... 12 more
    When I run the command lsof in UNIX which list the open file handles in the system
    $ /usr/sbin/lsof -p 22933 -i | grep CLOSE_WAIT
    java 22933 build_master 297u IPv6 129841943 TCP integration.com:47929->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    java 22933 build_master 298u IPv6 129841947 TCP integration.com:47933->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    java 22933 build_master 299u IPv6 129841950 TCP integration.com:47936->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    java 22933 build_master 300u IPv6 129841970 TCP integration.com:47952->UUU.XXX.YYY.ZZZ:http (CLOSE_WAIT)
    ���list of 935 connections similarly�
    I tried 2 solutions
    1. Got the HttpURLConnection from the URL object and invoked disconnect method on the same. But it doesn�t work.
    2. Ran the batch process java program with the parameter �Dhttp.keepAlive=false to close the underlying connection but didn�t help.
    I need the underlying sockets to be closed and not put in CLOSE_WAIT status after sending the mail.
    Is it the problem with the embed method of HtmlEmail object not closing the underlying socket connection.
    If anyone has faced this issue before, kindly let me know the possible solutions for the same ASAP.
    Thank you,
    Ramesh G

    This sounds more like a problem due to connection pooling at middle tier/application server.
    If that has been ruled out, then you might to enable DCD or set expiry time on the server.

  • Socket read() call returning before timeout.

    I have a couple of applications which use the following basic socket reading approach:
    Socket socket = new Socket("192.168.0.1", 54321);
    socket.setSoTimeout (5000);
    InputStream stream = socket.getInputStream();
    byte[] data = new byte[232];
    boolean done = false;
    while (!done) {
        int res= stream.read(data);
        if (res < data.length) {
            System.err.println ("Error reading packet data - not enough data received: "+ res);
        // process and output the data
    try { stream.close(); } catch (Exception e) {}
    try { socket.close(); } catch (Exception e) {}The problem I am having is that sometimes read(byte[]) returns a before the full array's worth of data has been read, and before a timeout has occurred. I never get a SocketTimeoutException, but I do get my debugging output. I have recorded the network traffic with a packet sniffer (Wireshark), and what I am seeing is that in the instances where the read returns prematurely, it stops at the end of a TCP packet. The rest of the data is in another packet that arrives shortly afterwords (~1.5 ms or less).
    I know that with normal (file) input streams, read can return whenever it wants regardless of how many bytes were read, however I was under the impression that network streams are supposed to block until all the data arrives (or a timeout occurs, if set). Is this incorrect?

    djpeaco wrote:
    I know that with normal (file) input streams, read can return whenever it wants regardless of how many bytes were readThat's correct and that's exactly the reason you see the behavior you see.
    however I was under the impression that network streams are supposed to block until all the data arrives (or a timeout occurs, if set).Why? Why do you think that network streams behave differently in this regard?
    Why shouldn't it give you the data as soon as it's available, when every other stream works this way?
    Is this incorrect?Yes, you must assume that the streams of a socket follow the general InputStream/OutputStream contract and that includes possibly returning from read() before the full array is filled.

  • JDBC pooling Oracle driver Socket read timed out

    I run Java EE application on Glassfish server v3 together with Oracle 12 DB on the same machine under Windows Server 2012 64bit. I use latest ojdbc7 driver.
    Connection pool config:
      <jdbc-connection-pool validation-table-name="DUAL" steady-pool-size="20" statement-cache-size="100" associate-with-thread="true" statement-timeout-in-seconds="30" idle-timeout-in-seconds="60" max-wait-time-in-millis="2000" validate-atmost-once-period-in-seconds="20" datasource-classname="oracle.jdbc.pool.OracleDataSource" pool-resize-quantity="5" max-pool-size="60" res-type="javax.sql.DataSource" name="dbPool" is-connection-validation-required="true">
      <property name="driverClass" value="oracle.jdbc.OracleDriver"></property>
      <property name="user" value="xxx"></property>
      <property name="url" value="jdbc:oracle:thin:@(DESCRIPTION=(ENABLE=BROKEN)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=orcl)))"></property>
      <property name="password" value="xxx"></property>
      <property name="portNumber" value="1521"></property>
      <property name="databaseName" value="orcl"></property>
      <property name="serverName" value="127.0.0.1"></property>
      <property name="oracle.jdbc.ReadTimeout" value="300000"></property>
      <property name="oracle.net.CONNECT_TIMEOUT" value="10000"></property>
      </jdbc-connection-pool>
    After 2 or 3 hours, when there is more than 1 user (3-5) using my application, it stops responding and I get this in glassfish logs
      javax.enterprise.resource.resourceadapter.com.sun.enterprise.resource.allocator|_ThreadID=152;_ThreadName=Thread-2;|RAR5038:Unexpected exception while creating resource for pool dbPool. Exception : javax.resource.spi.ResourceAllocationException: Connection could not be allocated because: IO Error: Socket read timed out
      Local Exception Stack:
      Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: IO Error: Socket read timed out
    From the database side it looks like this
    Fatal NI connect error 12560, connecting to:
      (LOCAL=NO)
      VERSION INFORMATION:
      TNS for 64-bit Windows: Version 12.1.0.1.0 - Production
      Oracle Bequeath NT Protocol Adapter for 64-bit Windows: Version 12.1.0.1.0 - Production
      Windows NT TCP/IP NT Protocol Adapter for 64-bit Windows: Version 12.1.0.1.0 - Production
      Time: 13-JUN-2014 03:14:49
      Tracing not turned on.
      Tns error struct:
      ns main err code: 12560
      TNS-12560: TNS:protocol adapter error
      ns secondary err code: 0
      nt main err code: 0
      nt secondary err code: 0
      nt OS err code: 0
      opiodr aborting process unknown ospid (3404) as a result of ORA-609
    When I just reset db listener everything works ok for next 1-2 hours (depends on application load). So temporary solution is to run bat script from windows scheduler to reset the listener every 1h.
    I tried everything I could find - applied these parameters:
      - Sqlnet.ora:
      SQLNET.INBOUND_CONNECT_TIMEOUT=180
      SQLNET.EXPIRE_TIME=5
      - Listener.ora:
      INBOUND_CONNECT_TIMEOUT_LISTENER_IPC=120
    But still without success

    Is the problem here just that you need a connection pool that closes idle connections?  Some pools will close idle connections after a time out period.  And the pool lets you set that time out period.  If the pool you are using doesn't provide that then use a different pool.

  • Which load testing tool is appropriate for sending message to a tcp socket

    Hi,
    I am new to the testing world. I have developed a messaging application, where the client sends his requests on to the server program which opens a socket and listens for messages. Then all mesaging goes on. I want to load test my application. I have tested it with Apache's JMeter, besides that are there any other load testing tools.
    The clients need to send messages on a tcp socket. I really need this, please help me.
    Thanks,

    Dude,
    Write one!
    I test any servers I've written by hammering them by writing a multi-threaded test program to simulate client activity, namely an initial login and then whatever other activity the client would usually perform. Maybe in your case this would involve the sending of messages, the checking/reading of new messages and logging out.
    I usually get my timing statistics by simply capturing a start time and an end time (the difference being the m/s taken). ie: using java.util.Date.
    Run the test program from a single host to iron out any initial problems, but then be sure to run it from as many different hosts as you can get your mitts on!

  • Socket reading -writing

    hello friends i am new to this forum and looking forward for some help from you guys
    suppose i open a socket and made a connection to the remote server
    now i have one socket with me and another corrresponding socket with the server .i write a very long string containig
    new lines out.println("vey long string");
    and i close the socket or the function in which i am doing this job exits.
    would the remote server able to read from its socket or not that is does the closing of socket on one side closes the whole connection.

    if its a TCP socket if you close one side the connection is closed, so it will not be able to read from its socket.

  • Receiving data through TCP Socket

    Hi all,
    I am trying to receive some data through TCP Socket from the
    server using XMLSocketClass. Ther server is responding with some
    data. But I can't access this data in my application. Pls tell me
    the reasons for not working of handler private function
    dataHandler(event:DataEvent):void .
    =============================================================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.collections.ArrayCollection;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.DataEvent;
    import flash.events.IOErrorEvent;
    import flash.net.XMLSocket;
    private var socket:XMLSocket;
    private var nextId:int;
    private var events:ArrayCollection = new ArrayCollection();
    public static var host:String = "34.234.43.97";
    public static var port:Number = 8002;
    public var xml:XML;
    private function connectToServer():void
    socket = new XMLSocket();
    socket.addEventListener(DataEvent.DATA, dataHandler);
    configureListeners(socket);
    socket.connect(host, port);
    //This function is Not working
    private function dataHandler(event:DataEvent):void {
    Alert.show("dataHandler: " + event.data);
    xml = new XML(event.data);
    Alert.show(xml); }
    private function
    configureListeners(dispatcher:IEventDispatcher):void {
    dispatcher.addEventListener(Event.CLOSE, closeHandler);
    dispatcher.addEventListener(Event.CONNECT, connectHandler);
    dispatcher.addEventListener(DataEvent.DATA, dataHandler);
    dispatcher.addEventListener(IOErrorEvent.IO_ERROR,
    ioErrorHandler);
    dispatcher.addEventListener(ProgressEvent.PROGRESS,
    progressHandler);
    dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    securityErrorHandler);
    private function closeHandler(event:Event):void {
    trace("closeHandler: " + event);
    private function ioErrorHandler(event:IOErrorEvent):void {
    trace("ioErrorHandler: " + event);
    private function progressHandler(event:ProgressEvent):void {
    trace("progressHandler loaded:" + event.bytesLoaded + "
    total: " + event.bytesTotal);
    private function
    securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
    /* private function dataHandler(event:DataEvent):void {
    trace("dataHandler: " + event);
    private function connectHandler(event:Event):void
    var obj:Object = new Object();
    obj.id = nextId++;
    obj.eventName="connect";
    obj.timestamp = new Date().valueOf();
    events.addItem(obj);
    private function sendData():void
    var xmlvalue:String=txtData.text.toString() ;
    var xmlfile:String =
    "<command>SndIns<parameter1>0x06</parameter1><parameter2>0x00</parameter2><parameter3>0x7 1</parameter3><parameter4>0x0F</parameter4><parameter5>0x11</parameter5><parameter6>0xFF</ parameter6></command>";
    socket.send(xmlfile);
    Alert.show(xmlfile);
    ]]>
    </mx:Script>
    <mx:HBox width="80%" horizontalAlign="center">
    <mx:TextInput id="txtData" name=""/>
    <mx:Button id="btnConnect" label="Connect"
    click="connectToServer();btnConnect.enabled = false"/>
    <mx:Button id="btnSend" label="Send Data"
    click="sendData()"/>
    <!--<mx:Button label="getData" id="btnGet"
    click="getData()"/>-->
    </mx:HBox>
    <mx:HBox x="10" y="30" width="100%">
    <mx:DataGrid width="80%" height="100%"
    dataProvider="{xml}">
    <mx:columns>
    <mx:Array>
    <mx:DataGridColumn headerText="Event Name"
    dataField="eventName"/>
    </mx:Array>
    </mx:columns>
    </mx:DataGrid>
    </mx:HBox>
    </mx:Application>

    Hi all,
    I am trying to receive some data through TCP Socket from the
    server using XMLSocketClass. Ther server is responding with some
    data. But I can't access this data in my application. Pls tell me
    the reasons for not working of handler private function
    dataHandler(event:DataEvent):void .
    =============================================================================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.collections.ArrayCollection;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.DataEvent;
    import flash.events.IOErrorEvent;
    import flash.net.XMLSocket;
    private var socket:XMLSocket;
    private var nextId:int;
    private var events:ArrayCollection = new ArrayCollection();
    public static var host:String = "34.234.43.97";
    public static var port:Number = 8002;
    public var xml:XML;
    private function connectToServer():void
    socket = new XMLSocket();
    socket.addEventListener(DataEvent.DATA, dataHandler);
    configureListeners(socket);
    socket.connect(host, port);
    //This function is Not working
    private function dataHandler(event:DataEvent):void {
    Alert.show("dataHandler: " + event.data);
    xml = new XML(event.data);
    Alert.show(xml); }
    private function
    configureListeners(dispatcher:IEventDispatcher):void {
    dispatcher.addEventListener(Event.CLOSE, closeHandler);
    dispatcher.addEventListener(Event.CONNECT, connectHandler);
    dispatcher.addEventListener(DataEvent.DATA, dataHandler);
    dispatcher.addEventListener(IOErrorEvent.IO_ERROR,
    ioErrorHandler);
    dispatcher.addEventListener(ProgressEvent.PROGRESS,
    progressHandler);
    dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    securityErrorHandler);
    private function closeHandler(event:Event):void {
    trace("closeHandler: " + event);
    private function ioErrorHandler(event:IOErrorEvent):void {
    trace("ioErrorHandler: " + event);
    private function progressHandler(event:ProgressEvent):void {
    trace("progressHandler loaded:" + event.bytesLoaded + "
    total: " + event.bytesTotal);
    private function
    securityErrorHandler(event:SecurityErrorEvent):void {
    trace("securityErrorHandler: " + event);
    /* private function dataHandler(event:DataEvent):void {
    trace("dataHandler: " + event);
    private function connectHandler(event:Event):void
    var obj:Object = new Object();
    obj.id = nextId++;
    obj.eventName="connect";
    obj.timestamp = new Date().valueOf();
    events.addItem(obj);
    private function sendData():void
    var xmlvalue:String=txtData.text.toString() ;
    var xmlfile:String =
    "<command>SndIns<parameter1>0x06</parameter1><parameter2>0x00</parameter2><parameter3>0x7 1</parameter3><parameter4>0x0F</parameter4><parameter5>0x11</parameter5><parameter6>0xFF</ parameter6></command>";
    socket.send(xmlfile);
    Alert.show(xmlfile);
    ]]>
    </mx:Script>
    <mx:HBox width="80%" horizontalAlign="center">
    <mx:TextInput id="txtData" name=""/>
    <mx:Button id="btnConnect" label="Connect"
    click="connectToServer();btnConnect.enabled = false"/>
    <mx:Button id="btnSend" label="Send Data"
    click="sendData()"/>
    <!--<mx:Button label="getData" id="btnGet"
    click="getData()"/>-->
    </mx:HBox>
    <mx:HBox x="10" y="30" width="100%">
    <mx:DataGrid width="80%" height="100%"
    dataProvider="{xml}">
    <mx:columns>
    <mx:Array>
    <mx:DataGridColumn headerText="Event Name"
    dataField="eventName"/>
    </mx:Array>
    </mx:columns>
    </mx:DataGrid>
    </mx:HBox>
    </mx:Application>

  • Tcp/ip communication problem

    hello,
    what i have is a tcp/ip communication problem.   the server needs to see the connection on the client side terminate before it can reply with data.  so i'm not sure the best way to
    solve this.  i tried to use a sequence structure to have the client open a connection  and then send data across the port and then terminate the connection.  the next part in the sequence would then open a connection and wait for the reply form the server.  i had this in a while loop. an example vi would be very appreciated

    Hi,
    You can search for TCP Communicator -Passive.vi and TCP Communicator -Active.vi examples in the example finder by selecting Help->Find Examples.
    Tunde A.

  • TCP Socket Adapter

    I want to use BPEL to integrate Oracle CRM with some banking software that validates bank sort codes and account numbers. The banking validation software listens for an input stream on a TCP socket.
    Can anyone tell me where I can find the technology socket adapter that are referenced on a number of Oracle presentations?
    I know I could write code in Java to achieved the same effect, but if there is an adapter that can do the job then that is preferable.

    I too am looking for this. I see that one of the posters above mentions an item provided by oracle, more details would be appreciated.
    In the mean time, I think the way to go is to write a POJO that sits on the the tcp port and gets into the ESB via a message queue, allowing it to "send an event" if you will.
    The scenario where you want to go outbound to tcp might be a bit trickier, if I use the POJO approach, then my code is outside of the ESB, since the ESB would end by dumping to a message queue, and my POJO would pick up from there.
    It would be really nice to have an Oracle component specificially for TCP.

  • How to send packet using tcp socket ?

    hi ,
    i want to using tcp socket to send data in ipv6 environment. but why the data transfer is less than ipv4 environment?
    socket = new Socket("2001:0238:0600::2", 1234);am i wrong ?

    bobby92 wrote:
    why the data transfer is less than ipv4 environment?What do you mean?
    >
    socket = new Socket("2001:0238:0600::2", 1234);am i wrong ?No idea, since I've no idea what you're asking.

  • Java.sql.SQLException: Socket read timed out

    // DbTest.java
    <code>
    import java.sql.*;
    import java.io.*;
    public class DbTest
    public static void main(String args[])
    System.out.println("DbTest main(-)");
    Connection con = null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    System.out.println("class loaded");
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcldb","scott","tiger");
    System.out.println("con obj created");
    System.out.println("con obj retrived");
    if (con!=null)
    System.out.println("Connection created successfully");
    else
    System.out.println("Connection refused");
    catch (SQLException e)
    e.printStackTrace();
    catch(Exception e)
    e.printStackTrace();
    </code>
    e:\JavaPrgms\JDBC>javac DbTest.java
    e:\JavaPrgms\JDBC>java DbTest
    DbTest main(-)
    class loaded
    java.sql.SQLException: Socket read timed out
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
    531)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
    n.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at DbTest.main(DbTest.java:17)
    Caused by: oracle.net.ns.NetException: Socket read timed out
    at oracle.net.ns.Packet.receive(Packet.java:320)
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:286)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
    ... 7 more
    i am using win 7 64bit os , Oracle 11.2, Jdk 1.7 how can i resolve this problem?
    Edited by: 910776 on Oct 4, 2012 10:49 AM

    Your other thread got locked because all you did was post a bunch of code without explaining what your question or issue was or what the code is supposed to be doing.
    java.sql.SQLException: Socket read timed out
    Simply reposting in this forum isn't enough. Edit your post and and add \ tags on the line before and the line after the code to preserve the formatting.
    Also explain what you are trying to do, the problem you are having and answer the questions I ask you in your other thread.
    {quote}
    What is it you are trying to do?
    Why are you trying to connect to two different databases?
    Do either of those databases actually exist?
    Do they exist on the local machine that Java is running on?
    Can you connect to either of them without using Java?
    {quote}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for

  • TextEdit problems: causes spinning ball/freezes, can't make it default app

    I'm having some serious problems with, of all things, TextEdit. On an iMac running 10.4.11 with TextEdit v. 1.4 (the standard version for Tiger), I've been having the following two major issues: 1. About once per day, or at least once every two days,

  • HP Officejet G85 - how do i print a fax report for previous month?

    When I select "Print Fax Report" from menu, prints only last 30 faxes. Can I print fax report of a longer period, such as the previous month?

  • I have a iphone 4 factory unlock can i trade in to iphone 4s factory unlocked?

    i have a iphone 4 factory unlocked now really like the iphone 4s factry unlock ican i do that? friend of mine did exchange his phone i phone 4 to 4s he said he paid $199 for the exchange

  • AutoCommit Issue

    Hello, I recently switched oracle drivers (using wls8.1, sp3 weblogic.jdbc.oracle.OracleDriver). I do an autoCommit(false), though it seems to ignore it. The executeUpdates seem to happen with no commit(). I actually had to remove the commit because

  • I can't upload photos to the internet

    I have search this site and haven't found the answer yet so, here goes... I can't seem to upload any photo files to the internet(I've tried Shutterfly and MySpace). Just a couple of months ago I was able to do this with no problems, now, suddenly, no