Leadtools.Jpip.Server Requires JPIP Module license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
ExtraDataOffset Property
See Also  Example
Leadtools.Jpip.HttpServer Namespace > HttpClientRequest Class : ExtraDataOffset Property



Gets the start offset of bytes that the HttpClientRequest didn't decode.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property ExtraDataOffset As Integer
Visual Basic (Usage)Copy Code
Dim instance As HttpClientRequest
Dim value As Integer
 
value = instance.ExtraDataOffset
C# 
public int ExtraDataOffset {get;}
C++/CLI 
public:
property int ExtraDataOffset {
   int get();
}

Return Value

If all data were decoded in the Process method this property return 0; otherwise return the starting offset of the extra bytes which not processed because the client request is completed.

Example

Visual BasicCopy Code
Public Class HttpServerCommunication
   <Test> _
   Private Sub ProcessClientRequests()
      Dim clientRequest As HttpClientRequest = Nothing
      Dim decoder As HttpRequestDecoder = Nothing
      Dim client As Socket

      client = GetClientSocket()
      clientRequest = New HttpClientRequest()
      Dim clientData As Byte()

      Dim received As Integer

      Do
         clientData = New Byte(client.ReceiveBufferSize - 1){}

         received = client.Receive(clientData)


         clientRequest.Process(clientData, 0, received)

      Loop While clientRequest.Execute 'receive data until a complete request is received

      Console.WriteLine("Client request received: {0}", clientRequest.CompleteMessage)

          File.WriteAllBytes(LeadtoolsExamples.Common.ImagesPath.Path + "ServerRequests.dat", clientRequest.BodyData)
      decoder = New HttpRequestDecoder(clientRequest)

      Console.WriteLine("Server will process client image {0}", decoder.Fields.RequestTargetFields.Target)


      'Process client request...
      '...

      client.Close()
   End Sub

   Private Function GetClientSocket() As Socket

      Dim listenSocket As Socket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

      Dim hostIP As IPAddress = IPAddress.Parse("127.0.0.1")
      Dim port As Integer = 107

      Dim ep As IPEndPoint = New IPEndPoint(hostIP, port)

      listenSocket.Bind(ep)

      ' start listening
      listenSocket.Listen(10)

      'a client should send a request to the listening address
      Dim client As Socket = listenSocket.Accept()

      listenSocket.Close()

      Return client
   End Function
End Class
C#Copy Code
public void ProcessClientRequests() 

    Leadtools.Examples.Support.Unlock(); 
   HttpClientRequest clientRequest = null; 
   HttpRequestDecoder decoder = null; 
   Socket client; 
   client = GetClientSocket(); 
   clientRequest = new HttpClientRequest(); 
   byte[] clientData ; 
   int received; 
   do 
   { 
      clientData = new byte[client.ReceiveBufferSize]; 
      received = client.Receive(clientData); 
      clientRequest.Process(clientData, 0,  received); 
   } while (clientRequest.Execute); //receive data until a complete request is received 
 
   Console.WriteLine( "Client request received: {0}", clientRequest.CompleteMessage); 
   File.WriteAllBytes(LeadtoolsExamples.Common.ImagesPath.Path + "ServerRequests.dat", clientRequest.BodyData); 
   decoder = new HttpRequestDecoder(clientRequest); 
   Console.WriteLine( "Server will process client image {0}", decoder.Fields.RequestTargetFields.Target); 
   //Process client request... 
   client.Close(); 

 
private Socket GetClientSocket() 

   Socket listenSocket = new Socket( AddressFamily.InterNetwork, 
                                     SocketType.Stream, 
                                     ProtocolType.Tcp); 
   IPAddress hostIP = IPAddress.Parse("127.0.0.1"); 
   int port = 107; 
   IPEndPoint ep = new IPEndPoint(hostIP, port); 
   listenSocket.Bind(ep); 
   // start listening 
   listenSocket.Listen(10); 
   //a client should send a request to the listening address 
   Socket _client = listenSocket.Accept(); 
   listenSocket.Close(); 
   return _client; 
}

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

Leadtools.Jpip.Server requires a JPIP Module and a server license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features