Click here to Skip to main content
15,912,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionKeypad Dialog Pin
Reagan Conservative11-Feb-09 3:42
Reagan Conservative11-Feb-09 3:42 
AnswerRe: Keypad Dialog Pin
David Crow11-Feb-09 4:28
David Crow11-Feb-09 4:28 
QuestionUrgent : Dialog box size? Pin
sam_psycho11-Feb-09 1:42
sam_psycho11-Feb-09 1:42 
AnswerRe: Urgent : Dialog box size? Pin
Stuart Dootson11-Feb-09 2:02
professionalStuart Dootson11-Feb-09 2:02 
GeneralRe: Urgent ? Pin
CPallini11-Feb-09 2:20
mveCPallini11-Feb-09 2:20 
GeneralRe: Urgent ? Pin
sam_psycho11-Feb-09 3:24
sam_psycho11-Feb-09 3:24 
JokeRe: Urgent ? Pin
«_Superman_»11-Feb-09 15:43
professional«_Superman_»11-Feb-09 15:43 
QuestionServer/Client Development Pin
raghu valluri11-Feb-09 0:30
raghu valluri11-Feb-09 0:30 
Hey this is my short code for a basic socket setup for communicating witha client. But i seem to be getting a lot errors from the header files themselves for ex i get an error from byteorder.h where long long is used but it says undefined type. please let me know if my code is fine and what i can do regarding the errors from the header files
here is the code:

void error(char *msg)
{
perror(msg);
exit(1);
}

int main(int argc, char *argv[])
{
int sockfd, newsockfd, portno, clilen;
char buffer[256];
struct sockaddr_in serv_addr, cli_addr;
int n;

if (argc < 2) {
fprintf(stderr,"ERROR, no port provided\n");
exit(1);
}

sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (sockfd < 0)
error("ERROR opening socket");

bzero((char *) &serv_addr, sizeof(serv_addr));
portno = atoi(argv[1]);

serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(portno);

if (bind(sockfd, (struct sockaddr *) &serv_addr,
sizeof(serv_addr)) < 0)
error("ERROR on binding");

listen(sockfd,5);

clilen = sizeof(cli_addr);
newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr,
&clilen);
if (newsockfd < 0)
error("ERROR on accept");

bzero(buffer,256);
n = read(newsockfd,buffer,255);
if (n < 0)
error("ERROR reading from socket");
printf("Here is the message: %s\n",buffer);

n = write(newsockfd,"I got your message",18);
if (n < 0)
error("ERROR writing to socket");
return 0;
}
AnswerRe: Server/Client Development Pin
Stuart Dootson11-Feb-09 0:59
professionalStuart Dootson11-Feb-09 0:59 
QuestionChecking ActiveX registration programmatically! Pin
Mohammad Khodaea11-Feb-09 0:27
Mohammad Khodaea11-Feb-09 0:27 
AnswerRe: Checking ActiveX registration programmatically! Pin
_AnsHUMAN_ 11-Feb-09 0:44
_AnsHUMAN_ 11-Feb-09 0:44 
AnswerRe: Checking ActiveX registration programmatically! Pin
Stuart Dootson11-Feb-09 0:53
professionalStuart Dootson11-Feb-09 0:53 
QuestionChild window problem Pin
Abhijit D. Babar11-Feb-09 0:12
Abhijit D. Babar11-Feb-09 0:12 
QuestionHow to build the application in release mode Pin
Member 465174110-Feb-09 23:29
Member 465174110-Feb-09 23:29 
AnswerRe: How to build the application in release mode Pin
Cedric Moonen10-Feb-09 23:54
Cedric Moonen10-Feb-09 23:54 
QuestionHow to find if a process has active UI ? Pin
dharani10-Feb-09 23:25
dharani10-Feb-09 23:25 
AnswerRe: How to find if a process has active UI ? Pin
«_Superman_»10-Feb-09 23:41
professional«_Superman_»10-Feb-09 23:41 
GeneralRe: How to find if a process has active UI ? Pin
dharani10-Feb-09 23:58
dharani10-Feb-09 23:58 
GeneralRe: How to find if a process has active UI ? Pin
«_Superman_»10-Feb-09 23:59
professional«_Superman_»10-Feb-09 23:59 
GeneralRe: How to find if a process has active UI ? Pin
David Crow11-Feb-09 4:34
David Crow11-Feb-09 4:34 
AnswerRe: How to find if a process has active UI ? Pin
Stuart Dootson11-Feb-09 0:43
professionalStuart Dootson11-Feb-09 0:43 
QuestionKilling exe after running Pin
pooja_friends10-Feb-09 20:47
pooja_friends10-Feb-09 20:47 
AnswerRe: Killing exe after running Pin
«_Superman_»10-Feb-09 20:52
professional«_Superman_»10-Feb-09 20:52 
GeneralRe: Killing exe after running Pin
pooja_friends10-Feb-09 23:33
pooja_friends10-Feb-09 23:33 
GeneralRe: Killing exe after running Pin
«_Superman_»10-Feb-09 23:43
professional«_Superman_»10-Feb-09 23:43 

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.