Click here to Skip to main content
15,902,908 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: An Ado problem ,help Pin
David Crow3-Nov-09 2:50
David Crow3-Nov-09 2:50 
RantRe: An Ado problem ,help [modified] Pin
Adam Roderick J5-Nov-09 21:47
Adam Roderick J5-Nov-09 21:47 
GeneralRe: An Ado problem ,help Pin
David Crow3-Nov-09 2:52
David Crow3-Nov-09 2:52 
QuestionReading Text From Single Line CEdit Pin
Judgement28 2-Nov-09 14:32
Judgement28 2-Nov-09 14:32 
AnswerRe: Reading Text From Single Line CEdit Pin
«_Superman_»2-Nov-09 15:53
professional«_Superman_»2-Nov-09 15:53 
GeneralRe: Reading Text From Single Line CEdit Pin
Judgement28 2-Nov-09 18:35
Judgement28 2-Nov-09 18:35 
QuestionRe: Reading Text From Single Line CEdit Pin
KarstenK2-Nov-09 21:24
mveKarstenK2-Nov-09 21:24 
QuestionC++ socket connection send problem Pin
sugarandcream2-Nov-09 13:11
sugarandcream2-Nov-09 13:11 
I have a C++ class that send command to a system

but since the system is not ready to test yet, I wrote a java server socket that listens to the commands that sends from the C++ client to see if the command is correct and also want to check to see if the C++ can receives any response from the server socket ....

I try to print the command while the java socket is reading it....however, I can only see the printout after I stop the client sending commands, it looks liked the C++ flushes the the command out once it is stopped..

the following is the the partial coding of my project that connects to the socket

initializing:
StringHelper temp;
memset ((char *)&serverAddress, 0, sizeof(struct sockaddr_in));

/* Get the host information for the hostname */
serverEnt = gethostbyname (serverHostName);
if ( serverEnt == NULL )
{
   ErrnoMapper enm;
   temp = temp + "Unable to find host name: " + serverHostName;
   temp = temp + " gethostbyname (): errno=" + errno + " " + enm.mapErrno( errno );
   cout << temp << endl;
}

serverAddress.sin_family = AF_INET;
serverAddress.sin_addr.s_addr = ((struct in_addr *)(serverEnt->h_addr))->s_addr;
serverAddress.sin_port = htons(serverPortNumber);


connecting to the host
StringHelper temp;

mySocketFd = socket (AF_INET, SOCK_STREAM, 0);

if ( mySocketFd == -1 )
{
   ErrnoMapper enm;
   temp = temp + "Unable to create socket to " + serverHostName;
   temp = temp + " socket(): errno=" + errno + " " + enm.mapErrno( errno );
   cout << temp << endl;
   close(mySocketFd);
}

/* connect to the remote server at the address which was just built into serverAddress */
if (connect(mySocketFd, &serverAddress, sizeof(struct sockaddr_in)) == -1)
{
   ErrnoMapper enm;
   temp = temp + "Unable connect to " + serverHostName + ", port=" + serverPortNumber;
   temp = temp + ",connect(),errno=" + errno + " " + enm.mapErrno( errno );
   cout << temp << enld;
   close(mySocketFd);
   return 0;
}


sending command
if ( send(theSocketId, theBuffer, theLength, 0) != theLength)
{
   ErrnoMapper enm;
   StringHelper temp("Unable to send to ");
   temp = temp + serverHostName + ", port number: " + serverPortNumber;
   temp = temp + " send() : errno=" + errno + " " + enm.mapErrno( errno );
   cout << temp << endl;
}

AnswerRe: C++ socket connection send problem Pin
«_Superman_»2-Nov-09 14:14
professional«_Superman_»2-Nov-09 14:14 
GeneralRe: C++ socket connection send problem Pin
sugarandcream2-Nov-09 14:31
sugarandcream2-Nov-09 14:31 
GeneralRe: C++ socket connection send problem Pin
«_Superman_»2-Nov-09 15:50
professional«_Superman_»2-Nov-09 15:50 
GeneralRe: C++ socket connection send problem Pin
Moak2-Nov-09 23:44
Moak2-Nov-09 23:44 
QuestionXCrashReport : Exception Handling and system calls Pin
aputic2-Nov-09 12:34
aputic2-Nov-09 12:34 
GeneralRe: XCrashReport : Exception Handling and system calls Pin
Moak3-Nov-09 7:25
Moak3-Nov-09 7:25 
GeneralRe: XCrashReport : Exception Handling and system calls Pin
aputic5-Nov-09 0:01
aputic5-Nov-09 0:01 
GeneralRe: XCrashReport : Exception Handling and system calls Pin
Moak5-Nov-09 0:53
Moak5-Nov-09 0:53 
QuestionC++ to MySQL Connections Pin
santhosh-padamatinti2-Nov-09 7:22
santhosh-padamatinti2-Nov-09 7:22 
AnswerRe: C++ to MySQL Connections Pin
loyal ginger2-Nov-09 10:37
loyal ginger2-Nov-09 10:37 
AnswerRe: C++ to MySQL Connections Pin
Saurabh.Garg2-Nov-09 14:57
Saurabh.Garg2-Nov-09 14:57 
QuestionSetSelection in CSliderCtrl not working in XP. Pin
iwt.dev2-Nov-09 6:08
iwt.dev2-Nov-09 6:08 
QuestionRe: SetSelection in CSliderCtrl not working in XP. Pin
David Crow2-Nov-09 6:30
David Crow2-Nov-09 6:30 
AnswerRe: SetSelection in CSliderCtrl not working in XP. Pin
iwt.dev2-Nov-09 8:48
iwt.dev2-Nov-09 8:48 
QuestionRe: SetSelection in CSliderCtrl not working in XP. Pin
David Crow2-Nov-09 10:10
David Crow2-Nov-09 10:10 
Questionhow to program a sending packet through selected network Adapter interface in the windows Pin
newjiang042-Nov-09 5:06
newjiang042-Nov-09 5:06 
QuestionUnicode support for CryptEncrypt(..) and CryptDecrypt(..) ........... Pin
hvgyufg28fh38tyr78hf2-Nov-09 4:55
hvgyufg28fh38tyr78hf2-Nov-09 4:55 

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.