473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Winsock and HTTP

I try to build something like a web interface for one of my tools. I have
got a problem:

char sendBuf[] = "HTTP/1.1 200 OK\nContent-Type:
text/html\n\n<HTML>\n<BODY>\nHallo\n</BODY>\n</HTML>\n";

I used winsock2 to send - no error in sending, but the browser do not like
to deal with the information in sendBuf[]. Is there something wrong in my
understanding of the HTTProtocoll?
Jul 22 '05 #1
6 2267
"Christian Drescher" <ch**********@gmx.net> wrote in message
news:ch**********@cephyr.cid.net...
I try to build something like a web interface for one of my tools. I have
got a problem:

char sendBuf[] = "HTTP/1.1 200 OK\nContent-Type:
text/html\n\n<HTML>\n<BODY>\nHallo\n</BODY>\n</HTML>\n";

I used winsock2 to send - no error in sending, but the browser do not like
to deal with the information in sendBuf[]. Is there something wrong in my
understanding of the HTTProtocoll?


1. Both WinSock and HTTP are off topic in this group.
2. HTTP requires CRLF (\r\n) pairs as line endings, so that's probably your
problem.
3. More info: http://www.ietf.org/rfc/rfc2616.txt?number=2616

--
Unforgiven

Jul 22 '05 #2
I edited answere in definition of HTTP

--code--

strcpy(sendbuf, "HTTP/1.0 200 OK\r\n" );
strcat(sendbuf, "Server: Custom server\r\n");
strcat(sendbuf, "Date: Tuesday, 07-Sep-04 14:47:04 GMT\r\n");
strcat(sendbuf, "Last-modified: Thursday, 07-Sep-04 10:44:53 GMT\r\n");
strcat(sendbuf, "Content-length: 6372\r\n");
strcat(sendbuf, "Content-type: text/html\r\n");
strcat(sendbuf, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2
Final//EN\">\r\n");
strcat(sendbuf, "<html>Hello</html>");

--/code--

The problem is that when I try to connect to the server though Internet
Explorer, I do't receive the answer from the server. Why?

For more details, I do the next thing:
1. The server runs on my computer, and waits connections
2. In Internet Explorer, I enter localhost-address 127.0.01
3. The server says that there is a client who is connected.
4. The server receives the request from the client.
5. The server sends an answer.
6. ERR: Internet Explorer prints "The page cannot be displayed".

I suppose that it must be an error in formating of my answer...
Jul 22 '05 #3
Christian Drescher wrote:
[redacted]

Once more: WinSock and HTTP are off topic in this group, as is IE. Try
a windows programming group.
Jul 22 '05 #4
> Try a windows programming group.

such as?
Jul 22 '05 #5
Christian Drescher wrote:
Try a windows programming group.

such as?


anything with the name "microsoft" or "windows" in it?

for example: microsoft.public.vstudio.development
or even comp.windows.ms.programmer
Jul 22 '05 #6

"Christian Drescher" <ch**********@gmx.net> wrote in message
news:ch**********@cephyr.cid.net...
Try a windows programming group.


such as?


news:comp.os.ms-windows.programmer.win32

john
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bill | last post by:
When vb6 Winsock.RemoteHost is set to "127.0.0.1", c# socket listener cannot hear connect request (my old vb6 winsock listener could hear it...). Why doesn't this work, and is there a work...
1
by: Yu Chai | last post by:
Hi guys, I created a ASP page that 1. users can run when WinSock proxy are using (ie's one is unchecked) 2. users can't run when WinSock proxy are using (ie's one is checked) 3. users can't run...
7
by: Nadav | last post by:
Hi I am writing some kind of a storage system that have to deal with large amounts of data passing over the net, Now, I Wonder... traditional programming would use win32 Winsock DLL as the means...
2
by: Nadav | last post by:
Hi, I am about to write a performance critical application and I wonder what is the best way to implement it... Should I use the standart Win32 winsock DLL or should I rather use the new managed...
3
by: John | last post by:
Hello, I currently have Visual Basic .NET 2003 Standard Edition. I would like to develop a standard exe which should use the Winsock Control for VB.NET. I found some tutorials about it, started...
5
by: kc | last post by:
Hi Just upgrading a app from VB6 to VB.Net. All is going well apart from the Winsock control. The first thing we notice is that there does not appear to be a .Net version (please correct me if...
1
by: Vincent | last post by:
I do not have a strong grasp of the winsock library, but have started fiddling around with it a bit. My first impression is that using winsock in Access is a bit unwieldy. I was making a...
1
by: Nicolas Ghesquiere | last post by:
Hello I have a problem with my current program. The meaning of the program is to allow users to login to a server to allow them to access the internet. My program communicates with a MS isa...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
3
AaronL
by: AaronL | last post by:
Hello, I am currently working on a project that has me in sort of a bind. What I want to do is retrieve web pages from the internet, and strip them down to just text. I'll get using Regular...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.