Allows reading and decoding HTTP values sent by a client.
public class HttpClientRequestPublic Class HttpClientRequestpublic ref class HttpClientRequestThe HttpClientRequest can read client data received in chunks by calling the Process method multiple times with the chunk data.
The HttpClientRequest support HTTP version 1.1
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.JpipImports Leadtools.Jpip.HttpServerImports Leadtools.Jpip.RequestDecoderImports Leadtools.Jpip.RequestEncoderImports Leadtools.Jpip.Client.WinFormsImports Leadtools.Jpip.Client.InteractiveDecoderImports Leadtools.Jpip.ServerImports Leadtools.Jpip.LoggingPublic Class HttpServerCommunicationPublic Sub ProcessClientRequests()Dim clientRequest As HttpClientRequest = NothingDim decoder As HttpRequestDecoder = NothingDim client As Socketclient = GetClientSocket()clientRequest = New HttpClientRequest()Dim clientData As Byte()Dim received As IntegerDoclientData = 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 receivedConsole.WriteLine("Client request received: {0}", clientRequest.CompleteMessage)File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "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 SubPrivate Function GetClientSocket() As SocketDim 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 = 107Dim ep As IPEndPoint = New IPEndPoint(hostIP, port)listenSocket.Bind(ep)' start listeninglistenSocket.Listen(10)'a client should send a request to the listening addressDim client As Socket = listenSocket.Accept()listenSocket.Close()Return clientEnd FunctionEnd ClassPublic NotInheritable Class LEAD_VARSPublic Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"End Class
using Leadtools;using Leadtools.Codecs;using Leadtools.Jpip;using Leadtools.Jpip.HttpServer ;using Leadtools.Jpip.RequestDecoder ;using Leadtools.Jpip.RequestEncoder ;using Leadtools.Jpip.Client.WinForms;using Leadtools.Jpip.Client.InteractiveDecoder;using Leadtools.Jpip.Server;using Leadtools.Jpip.Logging;public void ProcessClientRequests(){#if LEADTOOLS_V175_OR_LATERLeadtools.Examples.Support.SetLicense();#elseLeadtools.Examples.Support.Unlock();#endif // #if LEADTOOLS_V175_OR_LATERHttpClientRequest 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 receivedConsole.WriteLine( "Client request received: {0}", clientRequest.CompleteMessage);File.WriteAllBytes(Path.Combine(LEAD_VARS.ImagesDir, "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 listeninglistenSocket.Listen(10);//a client should send a request to the listening addressSocket _client = listenSocket.Accept();listenSocket.Close();return _client;}static class LEAD_VARS{public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";}
|
Products |
Support |
Feedback: HttpClientRequest Class - Leadtools.Jpip.Server |
Introduction |
Help Version 19.0.2017.3.22
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.