public class HttpRequestDecoder : oBJjr1fyO5gCV4pmHX Public Class HttpRequestDecoderInherits ILlYd6TZ3OZWj5RRYZ
public:ref class HttpRequestDecoder : ILlYd6TZ3OZWj5RRYZ
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(){Leadtools.Examples.Support.SetLicense();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 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:\LEADTOOLS21\Resources\Images";}
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:\LEADTOOLS21\Resources\Images"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
