Click here to Skip to main content
15,901,853 members
Home / Discussions / C#
   

C#

 
AnswerRe: Datasets and Reports Pin
Samuel Cherinet10-Mar-09 10:08
Samuel Cherinet10-Mar-09 10:08 
GeneralRe: Datasets and Reports Pin
Jacob Dixon10-Mar-09 17:26
Jacob Dixon10-Mar-09 17:26 
Questionhow to make network in graph topology Pin
sunnyk8610-Mar-09 6:51
sunnyk8610-Mar-09 6:51 
AnswerRe: how to make network in graph topology Pin
musefan10-Mar-09 7:26
musefan10-Mar-09 7:26 
QuestionCombobox value Pin
andrejmk10-Mar-09 6:31
andrejmk10-Mar-09 6:31 
AnswerRe: Combobox value Pin
Xmen Real 10-Mar-09 6:35
professional Xmen Real 10-Mar-09 6:35 
QuestionHow to display images in subitems of a listview control using <b>C#</b>? Pin
ADIDADPU10-Mar-09 6:22
ADIDADPU10-Mar-09 6:22 
AnswerRe: How to display images in subitems of a listview control using C#? Pin
Xmen Real 10-Mar-09 6:31
professional Xmen Real 10-Mar-09 6:31 
QuestionHow to convert html to pdf using C# tried to do but got error Pin
YiXiang_8910-Mar-09 5:39
YiXiang_8910-Mar-09 5:39 
AnswerRe: How to convert html to pdf using C# tried to do but got error Pin
Jack Li10-Mar-09 5:57
Jack Li10-Mar-09 5:57 
AnswerRe: How to convert html to pdf using C# tried to do but got error Pin
Curtis Schlak.10-Mar-09 6:10
Curtis Schlak.10-Mar-09 6:10 
QuestionvSystem.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer,Int32 offset,Int32 size,SocketFlags socketflags,Endpoint& remoteEP) [modified] Pin
mrithula810-Mar-09 4:28
mrithula810-Mar-09 4:28 
AnswerRe: vSystem.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer,Int32 offset,Int32 size,SocketFlags socketflags,Endpoint& remoteEP) Pin
Jimmanuel10-Mar-09 6:27
Jimmanuel10-Mar-09 6:27 
GeneralRe: vSystem.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer,Int32 offset,Int32 size,SocketFlags socketflags,Endpoint& remoteEP) Pin
mrithula811-Mar-09 19:01
mrithula811-Mar-09 19:01 
GeneralRe: vSystem.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer,Int32 offset,Int32 size,SocketFlags socketflags,Endpoint& remoteEP) Pin
Jimmanuel12-Mar-09 3:28
Jimmanuel12-Mar-09 3:28 
AnswerRe: vSystem.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer,Int32 offset,Int32 size,SocketFlags socketflags,Endpoint& remoteEP) Pin
mcldev10-Mar-09 10:32
mcldev10-Mar-09 10:32 
Your exception is probably something to do with the buffer, offset, and size. here are some guidelines that may help you understand and solve your problem:

The "buffer" must be large enough to accomodate the largest UDP datagram you expect to receive. Make sure you have a buffer that is large enough for you application. For example byte[] buffer = new buffer[1024];

Next, "offset" is the index to the buffer. First recv this is probably zero (0). Next recv it may be advanced by the value from the datagram PDU, e.g. a size of payload. The key here is offet MUST be with the bounds of the buffer 0 to n.
You should advance the offset by the bytes recv'd like this (with error checking of ocurse):
int nbytes = recv(buffer, offset, size, ...);
offset += nbytes


"Size" is determines how much. Let's say your first read got a 12 byte Header and in this header you extract a length. Well that means you would have used 12 for the first recv, and the if the payload size from the Header was 146 bytes, then your second recv would be for that amount. BUT you must make sure the offset advances before the second recv. Make sure you process recv errors, such as:
int nbytes = recv(buffer, offset, size, ...);

if (nbytes > 0)
   offset += nbytes;
else
   ProcessSocketError();


Good luck
QuestionCan't use base canvas as event dispatcher? Pin
emptythetill10-Mar-09 3:50
emptythetill10-Mar-09 3:50 
AnswerRe: Can't use base canvas as event dispatcher? Pin
emptythetill10-Mar-09 5:28
emptythetill10-Mar-09 5:28 
QuestionAdvice on Next Step Pin
TheScientistIsDead10-Mar-09 3:47
TheScientistIsDead10-Mar-09 3:47 
AnswerRe: Advice on Next Step Pin
Xmen Real 10-Mar-09 3:54
professional Xmen Real 10-Mar-09 3:54 
GeneralRe: Advice on Next Step Pin
Curtis Schlak.10-Mar-09 5:43
Curtis Schlak.10-Mar-09 5:43 
GeneralRe: Advice on Next Step Pin
Xmen Real 10-Mar-09 6:29
professional Xmen Real 10-Mar-09 6:29 
Questionneed help on C# ITEXT - Convert html to pdf Pin
YiXiang_8910-Mar-09 3:42
YiXiang_8910-Mar-09 3:42 
AnswerRe: need help on C# ITEXT - Convert html to pdf Pin
Yusuf10-Mar-09 3:46
Yusuf10-Mar-09 3:46 
QuestionActiveFomr.Invoke Pin
thomaxz.tc10-Mar-09 3:35
thomaxz.tc10-Mar-09 3:35 

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.