Click here to Skip to main content
15,891,253 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can i disable the One Page/Two Page button in the print preview window? Pin
AnoopVarma16-Feb-05 17:15
AnoopVarma16-Feb-05 17:15 
GeneralNagging Menu Check Problem Pin
LighthouseJ15-Feb-05 14:09
LighthouseJ15-Feb-05 14:09 
GeneralRe: Nagging Menu Check Problem Pin
Ravi Bhavnani15-Feb-05 14:44
professionalRavi Bhavnani15-Feb-05 14:44 
GeneralSteps to make a clickable area drawn by a user at run time Pin
joy00715-Feb-05 14:01
joy00715-Feb-05 14:01 
GeneralRe: Steps to make a clickable area drawn by a user at run time Pin
JWood15-Feb-05 14:56
JWood15-Feb-05 14:56 
GeneralRe: Steps to make a clickable area drawn by a user at run time Pin
Maximilien16-Feb-05 0:34
Maximilien16-Feb-05 0:34 
GeneralHelp Needed ASAP PLZ on downloading url content to file. Pin
A.Sal15-Feb-05 13:24
A.Sal15-Feb-05 13:24 
GeneralRe: Help Needed ASAP PLZ on downloading url content to file. Pin
vinnzy15-Feb-05 13:43
vinnzy15-Feb-05 13:43 
This code acts as a client...you can use any http server like apache or simple server
hope this solves your problem


#include <stdio.h>
#include <windows.h>


#define HTTP_SERVER_PORT 80
#define HTTP_SERVER_ADDRESS "Put your IP address here"

int main ()
{
int ret = 0, sock = 0, cl_sock = 0, client_addr_len = 0, recv_len = 0;
char recv_buff [2048] = {0,}, send_buff [1024] = {0,0};
struct sockaddr_in server_addr;
WSADATA wsaData;

printf ("\nConnecting to the Server [%s] on port [%d]\n", HTTP_SERVER_ADDRESS, HTTP_SERVER_PORT);

ret = WSAStartup (MAKEWORD (1,1), &wsaData);
if (ret != 0)
{
printf ("\nerror initializing Winsock\n");
return -1;
}

sock = socket (AF_INET, SOCK_STREAM, 0);
if (sock <= 0)
{
printf ("\nerror opening socket\n");
WSACleanup ();
return -1;
}

server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = inet_addr (HTTP_SERVER_ADDRESS);
server_addr.sin_port = htons (HTTP_SERVER_PORT);

if (connect (sock, (struct sockaddr*)&server_addr, sizeof(server_addr)) == SOCKET_ERROR)
{
printf ("Unable to connect to server\n");
closesocket (sock);
WSACleanup ();
return -1;
}

sprintf (send_buff, "%s", "GET HTTP/1.1\r\nConnection: close\r\nHost: HTTP_SERVER_ADDRESS\r\n\r\n");

ret = send (sock, send_buff, strlen (send_buff), 0);

printf ("Sent [%d] bytes Request [%s]\n", ret, send_buff) ;

recv_len = SOCKET_ERROR;

while( recv_len == SOCKET_ERROR )
{
recv_len = recv (sock, recv_buff, 1024, 0);
if (recv_len == 0 || recv_len == WSAECONNRESET)
{
printf( "Connection Closed.\n");
break;
}
if (recv_len < 0)
return -1;
}

printf( "\nBytes Recv: %ld\n\n", recv_len);

printf ("Received Data [%s]\n", recv_buff) ;

/*{
int i = 0 ;
for (i=0;i
GeneralRe: Help Needed ASAP PLZ on downloading url content to file. Pin
Ravi Bhavnani15-Feb-05 15:13
professionalRavi Bhavnani15-Feb-05 15:13 
GeneralRe: Help Needed ASAP PLZ on downloading url content to file. Pin
A.Sal16-Feb-05 0:17
A.Sal16-Feb-05 0:17 
Generalhelp with the operator overloading Pin
Flydian15-Feb-05 13:16
Flydian15-Feb-05 13:16 
GeneralRe: help with the operator overloading Pin
Bob Ciora16-Feb-05 1:34
Bob Ciora16-Feb-05 1:34 
Generalproblem returning arrays Pin
aaadetos15-Feb-05 13:05
aaadetos15-Feb-05 13:05 
GeneralRe: problem returning arrays Pin
John R. Shaw15-Feb-05 13:32
John R. Shaw15-Feb-05 13:32 
GeneralRe: problem returning arrays Pin
aaadetos15-Feb-05 16:12
aaadetos15-Feb-05 16:12 
GeneralRe: problem returning arrays Pin
$8816-Feb-05 20:30
$8816-Feb-05 20:30 
GeneralRe: problem returning arrays Pin
Branislav17-Feb-05 0:19
Branislav17-Feb-05 0:19 
GeneralRe: problem returning arrays Pin
aaadetos22-Feb-05 1:27
aaadetos22-Feb-05 1:27 
GeneralRe: problem returning arrays Pin
Branislav22-Feb-05 22:56
Branislav22-Feb-05 22:56 
GeneralRe: problem returning arrays Pin
$8816-Feb-05 0:14
$8816-Feb-05 0:14 
GeneralRe: problem returning arrays Pin
Anonymous22-Feb-05 1:23
Anonymous22-Feb-05 1:23 
GeneralRe: problem returning arrays Pin
$8822-Feb-05 2:17
$8822-Feb-05 2:17 
GeneralPrecompiled Headers Pin
JWood15-Feb-05 12:38
JWood15-Feb-05 12:38 
GeneralRe: Precompiled Headers Pin
Selvam R15-Feb-05 22:27
professionalSelvam R15-Feb-05 22:27 
GeneralRe: Precompiled Headers Pin
ionzarate16-Feb-05 2:56
ionzarate16-Feb-05 2:56 

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.