Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: ActiveFomr.Invoke Pin
thomaxz.tc10-Mar-09 3:37
thomaxz.tc10-Mar-09 3:37 
GeneralRe: ActiveFomr.Invoke Pin
Xmen Real 10-Mar-09 3:58
professional Xmen Real 10-Mar-09 3:58 
GeneralRe: ActiveFomr.Invoke Pin
thomaxz.tc10-Mar-09 4:15
thomaxz.tc10-Mar-09 4:15 
GeneralRe: ActiveFomr.Invoke Pin
Xmen Real 10-Mar-09 4:22
professional Xmen Real 10-Mar-09 4:22 
GeneralRe: ActiveFomr.Invoke [modified] Pin
thomaxz.tc10-Mar-09 4:27
thomaxz.tc10-Mar-09 4:27 
GeneralRe: ActiveFomr.Invoke Pin
thomaxz.tc10-Mar-09 5:00
thomaxz.tc10-Mar-09 5:00 
GeneralRe: ActiveFomr.Invoke Pin
Xmen Real 10-Mar-09 5:31
professional Xmen Real 10-Mar-09 5:31 
QuestionReversing letters in a word Pin
Johnny Jackson10-Mar-09 3:18
Johnny Jackson10-Mar-09 3:18 

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.