Click here to Skip to main content
15,909,827 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Where does the application's code go? Pin
Mark Salsbery17-Sep-07 12:23
Mark Salsbery17-Sep-07 12:23 
QuestionCreating "light" backups of Visual Studio projects... Pin
@largeinsd17-Sep-07 11:14
@largeinsd17-Sep-07 11:14 
AnswerRe: Creating "light" backups of Visual Studio projects... Pin
bob1697217-Sep-07 18:00
bob1697217-Sep-07 18:00 
GeneralRe: Creating "light" backups of Visual Studio projects... Pin
@largeinsd18-Sep-07 7:01
@largeinsd18-Sep-07 7:01 
QuestionUDP Application on Vista: Fail on sendto function Pin
Cris17-Sep-07 10:20
Cris17-Sep-07 10:20 
AnswerRe: UDP Application on Vista: Fail on sendto function Pin
Mark Salsbery17-Sep-07 11:32
Mark Salsbery17-Sep-07 11:32 
AnswerRe: UDP Application on Vista: Fail on sendto function Pin
David Crow17-Sep-07 11:56
David Crow17-Sep-07 11:56 
GeneralRe: UDP Application on Vista: Fail on sendto function Pin
Cris18-Sep-07 3:53
Cris18-Sep-07 3:53 
This is my code:

<br />
SOCKET m_maSocketOut;<br />
struct sockaddr_in m_SockAddrOut;<br />
unsigned long m_lInet;<br />
.<br />
.<br />
<br />
void init(CString strServer)<br />
{<br />
unsigned long lInet=0;<br />
<br />
memset(&m_SockAddrOut, 0, sizeof(m_SockAddrOut));<br />
<br />
m_maSocketOut = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); <br />
m_SockAddrOut.sin_family = AF_INET;<br />
m_SockAddrOut.sin_port = htons(port);<br />
<br />
struct hostent FAR* hp = gethostbyname((char FAR *) (const char *) strServer);<br />
<br />
if (hp == NULL)<br />
{<br />
   lInet = inet_addr((const char * ) strServer); <br />
   if (lInet != INADDR_NONE)	<br />
   {<br />
      validIP = TRUE;		<br />
      byAddress = TRUE;		<br />
   }<br />
}<br />
else<br />
   validIP = TRUE;<br />
	<br />
if (validIP)<br />
{<br />
   if (byAddress)<br />
   {<br />
      m_SockAddrOut.sin_addr.s_addr = lInet;<br />
      m_lInet = lInet;<br />
   }<br />
   else<br />
   {<br />
      m_SockAddrOut.sin_addr.s_addr = *((unsigned long far *) hp->h_addr);<br />
      m_lInet = *((unsigned long far *) hp->h_addr);<br />
   }<br />
<br />
   if (m_maSocketOut != NULL)<br />
   {<br />
      bind(m_maSocketOut, (SOCKADDR*)& m_SockAddrOut, sizeof(m_SockAddrOut));<br />
      WSAAsyncSelect(m_maSocketOut, hWnd, WM_EXTERNA, FD_READ | FD_CLOSE);<br />
   }<br />
}<br />
}<br />
<br />
void sendData(char szData[], int len)<br />
{<br />
   int result = sendto(m_maSocketOut, (char FAR *) &szData, len, <br />
		    NULL, (PSOCKADDR) &m_SockAddrOut, sizeof(m_SockAddrOut));<br />
   m_SockAddrOut.sin_addr.s_addr = INADDR_ANY;<br />
<br />
   if (result < 0)<br />
   {<br />
      int erroCode = WSAGetLastError();<br />
      //erroCode = 10022 in Windows Vista!!<br />
   }<br />
}<br />


Important: This error code is only on Windows Vista, but not all instalations . I don't know which the exat situation, but I observed in Business and Ultimate version.

Any idea?
QuestionRe: UDP Application on Vista: Fail on sendto function Pin
David Crow18-Sep-07 3:58
David Crow18-Sep-07 3:58 
AnswerRe: UDP Application on Vista: Fail on sendto function Pin
Cris18-Sep-07 4:44
Cris18-Sep-07 4:44 
GeneralRe: UDP Application on Vista: Fail on sendto function Pin
Cris20-Sep-07 3:28
Cris20-Sep-07 3:28 
QuestionHTML help integration Pin
Nathan Holt at EMOM17-Sep-07 9:41
Nathan Holt at EMOM17-Sep-07 9:41 
QuestionFailed new operator Pin
Joe Smith IX17-Sep-07 9:03
Joe Smith IX17-Sep-07 9:03 
AnswerRe: Failed new operator Pin
Mark Salsbery17-Sep-07 9:21
Mark Salsbery17-Sep-07 9:21 
GeneralRe: Failed new operator Pin
Joe Smith IX17-Sep-07 9:25
Joe Smith IX17-Sep-07 9:25 
GeneralRe: Failed new operator Pin
Mark Salsbery17-Sep-07 9:32
Mark Salsbery17-Sep-07 9:32 
GeneralRe: Failed new operator Pin
Joe Smith IX17-Sep-07 9:42
Joe Smith IX17-Sep-07 9:42 
AnswerRe: Failed new operator Pin
Nathan Holt at EMOM17-Sep-07 9:35
Nathan Holt at EMOM17-Sep-07 9:35 
GeneralRe: Failed new operator Pin
Joe Smith IX17-Sep-07 9:47
Joe Smith IX17-Sep-07 9:47 
GeneralRe: Failed new operator Pin
Nathan Holt at EMOM17-Sep-07 10:24
Nathan Holt at EMOM17-Sep-07 10:24 
GeneralRe: Failed new operator Pin
Joe Smith IX17-Sep-07 16:34
Joe Smith IX17-Sep-07 16:34 
QuestionRe: Failed new operator Pin
Mark Salsbery17-Sep-07 18:28
Mark Salsbery17-Sep-07 18:28 
AnswerRe: Failed new operator Pin
Joe Smith IX17-Sep-07 21:21
Joe Smith IX17-Sep-07 21:21 
GeneralRe: Failed new operator Pin
Mark Salsbery18-Sep-07 5:16
Mark Salsbery18-Sep-07 5:16 
GeneralRe: Failed new operator Pin
Nathan Holt at EMOM18-Sep-07 7:29
Nathan Holt at EMOM18-Sep-07 7:29 

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.