Home » SQL & PL/SQL » SQL & PL/SQL » problem with tcp/ip communication between client and server (oracle 10g)
problem with tcp/ip communication between client and server [message #456461] Tue, 18 May 2010 01:53 Go to next message
manojolak
Messages: 4
Registered: May 2010
Location: kolkata
Junior Member

my requirement is:
i am using utl_tcp package for tcp/ip communication between client(my client application based on c#) and server(plsql code for server).

when i am sending data to client, then client receives that data successfully but when client sends back some data to server, my code does not receive client's requested data.

manoj olak

[Updated on: Tue, 18 May 2010 02:01] by Moderator

Report message to a moderator

Re: problem with tcp/ip communication between client and server [message #456466 is a reply to message #456461] Tue, 18 May 2010 02:04 Go to previous messageGo to next message
rahulvb
Messages: 924
Registered: October 2009
Location: Somewhere Near Equator.
Senior Member
Post your code ( Test Case ).
Re: problem with tcp/ip communication between client and server [message #456472 is a reply to message #456461] Tue, 18 May 2010 02:15 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Do you think you could, if you tried, provide less useful information.

No Error messages
No Code
No data

All least to no answer.
problem with tcp/ip communication between client and server [message #456494 is a reply to message #456461] Tue, 18 May 2010 03:06 Go to previous messageGo to next message
manojolak
Messages: 4
Registered: May 2010
Location: kolkata
Junior Member

my requirement is:
i am using utl_tcp package for tcp/ip communication between client(my client application based on c#) and server(plsql code for server).

when i am sending data to client, then client receives that data successfully but when client sends back some data to server, my code does not receive client's requested data.

1. use this package
CREATE OR REPLACE PACKAGE BODY TESTING.test_tcp_ip_conn
IS
   g_l_con   UTL_TCP.connection;  
   
   PROCEDURE send_message (p_message IN VARCHAR2)
   IS     
   BEGIN
      g_l_con :=
         UTL_TCP.open_connection (remote_host      => '192.210.1.20',
                                  remote_port      => 11500
                                 );
      v_ret_val := UTL_TCP.write_line (g_l_con, p_message);
      cyms_trace.createlog_into_directory
                                     ('TESTING.TEST_TCP_IP_CONN.SEND_MESSAGE',
                                      TO_CHAR (v_ret_val)
                                     );
      
      UTL_TCP.close_connection (g_l_con);
      UTL_TCP.close_all_connections;
   EXCEPTION
      WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line ('error = ' || SQLERRM);
         UTL_TCP.close_all_connections;
         RETURN;
   END;

   PROCEDURE receive_message
   IS
      v_ret_val   NUMBER;
      v_data      VARCHAR2 (255);
      v_num       NUMBER;
      len         PLS_INTEGER;
   --v_count     BOOLEAN        := FALSE;
   BEGIN      
      UTL_TCP.close_all_connections;
      g_l_con :=
         UTL_TCP.open_connection (remote_host      => '132.186.97.169',
                                  remote_port      => 1521
                                 );

      BEGIN
         WHILE TRUE
         LOOP
            dbms_output.PUT_LINE(utl_tcp.GET_LINE(g_l_con,true));
            IF UTL_TCP.available (g_l_con) > 0
            THEN
               len := UTL_TCP.read_text (g_l_con, v_data, 256);
               DBMS_OUTPUT.put_line (len);
               cyms_trace.createlog_into_directory
                                 ('TESTING.TEST_TCP_IP_CONN.RECEIVE_MESSAGE',
                                  TO_CHAR (len)
                                 );
               --v_ret_val := UTL_TCP.read_line (g_con, v_data, FALSE);
               DBMS_OUTPUT.put_line (v_data);
               cyms_trace.createlog_into_directory
                                  ('TESTING.TEST_TCP_IP_CONN.RECEIVE_MESSAGE',
                                   v_data
                                  );
            END IF;
         END LOOP;
      EXCEPTION
         WHEN UTL_TCP.end_of_input
         THEN
            NULL;
      END;
   EXCEPTION
      WHEN OTHERS
      THEN
         DBMS_OUTPUT.put_line ('error = ' || SQLERRM);
         cyms_trace.createlog_into_directory
                                 ('TESTING.TEST_TCP_IP_CONN.RECEIVE_MESSAGE',
                                  SQLERRM
                                 );
         UTL_TCP.close_all_connections;
         RETURN;
   END;
END;
/

2. call send_message procedure from this procedure.
CREATE OR REPLACE PROCEDURE testing.sendtohmi
AS
   v_mesg   VARCHAR2 (200) := NULL;
BEGIN
   v_mesg := '11022 hello ?? \n';
   testing.test_tcp_ip_conn.send_message (v_mesg);
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('error = ' || SQLERRM);
      cyms_trace.createlog_into_directory ('TESTING.SENDTOHMI', SQLERRM);
      RETURN;
END;

3. call receive_message procedure from the job.


regard's
manoj olak




CM: added [code] tags - please do so yourself next time - see the orafaq forum guide if you're not sure how.

[Updated on: Tue, 18 May 2010 03:20] by Moderator

Report message to a moderator

Re: problem with tcp/ip communication between client and server [message #456570 is a reply to message #456494] Tue, 18 May 2010 09:10 Go to previous message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
ALWAYS
Post Operating System (OS) name & version for DB server system.
Post results of
SELECT * from v$version
or post Oracle version to 4 decimal places

It would be helpful if you followed Posting Guidelines - http://www.orafaq.com/forum/t/88153/0/
Previous Topic: multiple join table
Next Topic: Consuming a webservice by UTL_HTTP
Goto Forum:
  


Current Time: Mon Mar 18 22:01:49 CDT 2024