|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Member
Iscritto dal: Dec 2007
Messaggi: 47
|
[Visual C++ 8] Invio dati UDP con CAsysncSocket::SendTo
Devo inviare dei dati via UDP.
Il pacchetto è fatto da: 4 bytes 4 bytes 1 bytes 1 bytes 2 bytes 4 bytes 4 bytes La funzione che uso è la CAsysncSocket::SendTo così definita int SendTo( const void* lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress = NULL, int nFlags = 0 ); Il problema è che non so costruire il buffer da inviare. Dal prototipo si vede essere un const void* lpBuf. Quindi dovrei dichiarare un array di 20 bytes ed inviarli. Ma come lo costruisco?? C'è nessuno che può darmi una mano? |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Mar 2006
Città: Bergamo
Messaggi: 2499
|
Codice:
char buffer[20];
__________________
ho concluso con: kvegeta, doctordb, Leland Gaunt.
|
|
|
|
|
|
#3 |
|
Bannato
Iscritto dal: Feb 2005
Città: Roma
Messaggi: 7029
|
questo non è un problema di CAsyncSocket::SendTo figlio mio, tu non sai passare un array ad una funzione. Kernighan & Ritchie subito.
|
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Devi fare una struttura dati e poi passarla a quella funzione.
|
|
|
|
|
|
#5 |
|
Member
Iscritto dal: Dec 2007
Messaggi: 47
|
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 00:26.











ho concluso con: kvegeta, doctordb, Leland Gaunt.









