Click here to Skip to main content
14,367,095 members

C / C++ / MFC

 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Dave Kreskowiak17-Oct-18 11:36
mveDave Kreskowiak17-Oct-18 11:36 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Richard MacCutchan17-Oct-18 11:36
protectorRichard MacCutchan17-Oct-18 11:36 
GeneralRe: Split paragraph into lines based on width in pixels Pin
leon de boer17-Oct-18 19:39
memberleon de boer17-Oct-18 19:39 
GeneralRe: Split paragraph into lines based on width in pixels Pin
Richard MacCutchan17-Oct-18 22:28
protectorRichard MacCutchan17-Oct-18 22:28 
AnswerRe: Split paragraph into lines based on width in pixels Pin
Joe Woodbury18-Oct-18 14:11
professionalJoe Woodbury18-Oct-18 14:11 
Questionchange C code from persistent to none persistent in HTML Pin
Roozbeh Amiressami17-Oct-18 1:51
memberRoozbeh Amiressami17-Oct-18 1:51 
QuestionRe: change C code from persistent to none persistent in HTML Pin
Richard MacCutchan17-Oct-18 3:24
protectorRichard MacCutchan17-Oct-18 3:24 
AnswerRe: change C code from persistent to none persistent in HTML Pin
leon de boer17-Oct-18 4:48
memberleon de boer17-Oct-18 4:48 
Your server code doesn't even appear to be sending a header at the moment, so client will assume you are http 1.0 server and default of close connection.

Look at the rosseta code for a Web server .. goto the C section .. you should recognize the code
Hello world/Web server - Rosetta Code[^]

The moment it connects to the client it sends a header to the client
write(client_fd, response, sizeof(response) - 1); /*-1:'\0'*/

The header is at top of code and looks like this
char response[] = "HTTP/1.1 200 OK\r\n"
"Content-Type: text/html; charset=UTF-8\r\n\r\n"
"<!DOCTYPE html><html><head><title>Bye-bye baby bye-bye</title>"
"<style>body { background-color: #111 }"
"h1 { font-size:4cm; text-align: center; color: black;"
" text-shadow: 0 0 2mm red}</style></head>"
"<body><h1>Goodbye, world!</h1></body></html>\r\n";

So they are sending a header telling client the server is HTML 1.1 and will have persistent connections.
The alternative is to send a 1.0 header with the keep-alive tag

Then you simply don't close the connection until it times out. It's designed as a start point you need to
flesh out the rest from there.
In vino veritas


modified 17-Oct-18 10:16am.

QuestionGeolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 1:13
memberjung-kreidler17-Oct-18 1:13 
AnswerRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 3:02
memberVictor Nijegorodov17-Oct-18 3:02 
GeneralRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 21:04
memberjung-kreidler17-Oct-18 21:04 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 21:46
memberVictor Nijegorodov17-Oct-18 21:46 
GeneralRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 21:49
memberjung-kreidler17-Oct-18 21:49 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov17-Oct-18 22:07
memberVictor Nijegorodov17-Oct-18 22:07 
AnswerRe: Geolocation or how to find the country were my app is started Pin
jung-kreidler17-Oct-18 22:22
memberjung-kreidler17-Oct-18 22:22 
GeneralRe: Geolocation or how to find the country were my app is started Pin
Victor Nijegorodov18-Oct-18 0:51
memberVictor Nijegorodov18-Oct-18 0:51 
QuestionCalculating decimal places - Pin
ptr_Electron16-Oct-18 2:56
memberptr_Electron16-Oct-18 2:56 
AnswerRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 3:05
protectorRichard MacCutchan16-Oct-18 3:05 
AnswerRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:26
memberptr_Electron16-Oct-18 3:26 
GeneralRe: Calculating decimal places - Pin
Richard MacCutchan16-Oct-18 4:40
protectorRichard MacCutchan16-Oct-18 4:40 
SuggestionRe: Calculating decimal places - Pin
David Crow16-Oct-18 3:47
memberDavid Crow16-Oct-18 3:47 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 3:52
memberptr_Electron16-Oct-18 3:52 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 4:03
memberptr_Electron16-Oct-18 4:03 
GeneralRe: Calculating decimal places - Pin
David Crow16-Oct-18 4:06
memberDavid Crow16-Oct-18 4:06 
GeneralRe: Calculating decimal places - Pin
ptr_Electron16-Oct-18 4:14
memberptr_Electron16-Oct-18 4:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.