Click here to Skip to main content
16,004,924 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CDaoDatabase Pin
Khathar30-Apr-07 2:24
Khathar30-Apr-07 2:24 
AnswerRe: CDaoDatabase Pin
David Crow30-Apr-07 3:09
David Crow30-Apr-07 3:09 
QuestionHow can I send/receive a struct via winsock? Pin
deerhunter8929-Apr-07 23:25
deerhunter8929-Apr-07 23:25 
AnswerRe: How can I send/receive a struct via winsock? Pin
Mark Salsbery30-Apr-07 7:50
Mark Salsbery30-Apr-07 7:50 
QuestionRe: How can I send/receive a struct via winsock? Pin
deerhunter891-May-07 3:33
deerhunter891-May-07 3:33 
AnswerRe: How can I send/receive a struct via winsock? Pin
Moak1-May-07 3:59
Moak1-May-07 3:59 
QuestionRe: How can I send/receive a struct via winsock? Pin
deerhunter891-May-07 7:10
deerhunter891-May-07 7:10 
AnswerRe: How can I send/receive a struct via winsock? Pin
Moak1-May-07 7:33
Moak1-May-07 7:33 
If the string argument is a LPCSTR you could use the following example code on server side...

class CServerSocket<br />
{<br />
  enum { DATA_BUFFER_SIZE = 1024 };<br />
  struct DATASTRUCT {<br />
    char param1[DATA_BUFFER_SIZE];<br />
    char param2[DATA_BUFFER_SIZE];<br />
  };<br />
};<br />
<br />
const char* SERVER_STR1 = "Welcome to the Server";<br />
const char* SERVER_STR2 = "The weather is fine today";<br />
<br />
CServerSocket::SendResponse(SOCKET sckConnection)<br />
{<br />
DATASTRUCT serverResponse<br />
strncpy(serverResponse.param1, SERVER_STR1, DATA_BUFFER_SIZE);<br />
strncpy(serverResponse.param2, SERVER_STR2, DATA_BUFFER_SIZE);<br />
send(sckConnection, (const char*)&serverResponse, sizeof(serverResponse), 0);<br />
}


Hope it helps Big Grin | :-D

PS: The implementation would be different if you work with UNICODE strings.
GeneralRe: How can I send/receive a struct via winsock? Pin
deerhunter892-May-07 11:15
deerhunter892-May-07 11:15 
AnswerRe: How can I send/receive a struct via winsock? Pin
Mark Salsbery1-May-07 4:32
Mark Salsbery1-May-07 4:32 
AnswerRe: How can I send/receive a struct via winsock? Pin
Moak1-May-07 8:11
Moak1-May-07 8:11 
AnswerRe: How can I send/receive a struct via winsock? Pin
hmaturana30-Apr-07 13:36
hmaturana30-Apr-07 13:36 
Questionlist control and selected records Pin
hero199529-Apr-07 23:24
hero199529-Apr-07 23:24 
AnswerRe: list control and selected records Pin
Venkata Rama Subbarao30-Apr-07 1:45
Venkata Rama Subbarao30-Apr-07 1:45 
QuestionRe: list control and selected records Pin
David Crow30-Apr-07 3:17
David Crow30-Apr-07 3:17 
Questionthe equivalent of instructions in assembly Pin
zon_cpp29-Apr-07 22:51
zon_cpp29-Apr-07 22:51 
AnswerRe: the equivalent of instructions in assembly Pin
Cmania29-Apr-07 23:00
Cmania29-Apr-07 23:00 
AnswerRe: the equivalent of instructions in assembly Pin
Cmania29-Apr-07 23:06
Cmania29-Apr-07 23:06 
GeneralRe: the equivalent of instructions in assembly Pin
zon_cpp30-Apr-07 0:17
zon_cpp30-Apr-07 0:17 
GeneralRe: the equivalent of instructions in assembly Pin
markkuk30-Apr-07 0:29
markkuk30-Apr-07 0:29 
GeneralRe: the equivalent of instructions in assembly Pin
zon_cpp30-Apr-07 1:18
zon_cpp30-Apr-07 1:18 
Questiondoes thread returns a value.... Pin
neha.agarwal2729-Apr-07 21:16
neha.agarwal2729-Apr-07 21:16 
AnswerRe: does thread returns a value.... Pin
Stephen Hewitt29-Apr-07 21:21
Stephen Hewitt29-Apr-07 21:21 
Questionregarding property pages Pin
Sunshine Always29-Apr-07 21:08
Sunshine Always29-Apr-07 21:08 
AnswerRe: regarding property pages Pin
_AnsHUMAN_ 29-Apr-07 21:37
_AnsHUMAN_ 29-Apr-07 21:37 

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.