KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a small HTTP-Server here written in C# and until now I only needed to send raw text back to the sender. But now I have to send a JPG-Image and I dont unterstand how. this is what I have now: // Read the HTTP Request Byte[] bReceive = new Byte[MAXBUFFERSIZE]; int i = socket.Receive(bReceive, bReceive.Length, 0); //Convert Byte to String string sBuffer = Encoding.ASCII.GetString(bReceive); // Look for HTTP request iStartPos = sBuffer.IndexOf("HTTP", 1); // Extract the Command without GET_/ at the beginning and _HTTP at the end sRequest = sBuffer.Substring(5, iStartPos - 1 - 5); String answer = handleRequest(sRequest); // Send the response socket.Send(Encoding.UTF8.GetBytes(answer)); I think I have to do some kind of filestream instead of a string but I really have no glue..
Tags (comma-separated)
Save Edits
Cancel