Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5232

.net Thrift nuget package TSocket(host,port) fails for all non local host connections

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.13.0
    • None
    • netstd - Library
    • None
    • Windows 10, .net 4.5.1 project on visual studio 2019 version 6.3.5

      .net framework 4.8.03761

    Description

      Using the .net nuget package ApacheThrift version 0.13.0.1 to connect to a hbase thrift2 thrift server running on a seperate machine TSocket(host,port) will fail with the error: 

       

      testhost.x86.exe Error: 0 : =============== Custom exception handling in HbasePortClient openAndGetScannerRowsCollection =============== testhost.x86.exe Error: 0 : Exception:  System.Net.Sockets.SocketException.
      testhost.x86.exe Error: 0 : FailCount:  1.
      testhost.x86.exe Error: 0 : Message:    A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
      testhost.x86.exe Error: 0 : StackTrace:    at System.Net.Sockets.TcpClient.Connect(String hostname, Int32 port)
         at Thrift.Transport.TSocket.Open()
         at Thrift.Transport.TBufferedTransport.Open()
      

       

      For the following code:

                          socket = new TSocket(host, port);
                          transport = new TFramedTransport(socket);
                          transport.open();
                          TCompactProtocol proto = new TCompactProtocol(transport);
                          m_LazyClient = new THBaseService.Client(proto);
      

      We tried with and without the open() command on the socket, transport etc.

      This however does work if you are connecting to localhost (via putty ssh port forwarding)

      As a workaround, the following code does work:

                          TcpClient cli = new TcpClient(host, port);
                          socket = new TSocket(cli);
                          transport = new TFramedTransport(socket);
                          TCompactProtocol proto = new TCompactProtocol(transport);
                          m_LazyClient = new THBaseService.Client(proto);
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            adenner Andrew Denner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: