Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
GeneralRe: using string[] to call dll for const char *arg[] Pin
eggie525-May-05 15:52
eggie525-May-05 15:52 
QuestionTimeSpanPicker for Windows Forms? Pin
Uwe Keim24-May-05 22:48
sitebuilderUwe Keim24-May-05 22:48 
AnswerRe: TimeSpanPicker for Windows Forms? Pin
mav.northwind25-May-05 2:48
mav.northwind25-May-05 2:48 
GeneralDetect if ocx is installed Pin
NoXuS24-May-05 22:38
NoXuS24-May-05 22:38 
GeneralRe: Detect if ocx is installed Pin
John Fisher25-May-05 7:38
John Fisher25-May-05 7:38 
GeneralRe: Detect if ocx is installed Pin
NoXuS25-May-05 21:35
NoXuS25-May-05 21:35 
Generalsocket connection in a .NET Applet (Windowsformcontrol hosted on browser) Pin
drkalucard24-May-05 22:16
drkalucard24-May-05 22:16 
GeneralRe: socket connection in a .NET Applet (Windowsformcontrol hosted on browser) Pin
Judah Gabriel Himango25-May-05 4:15
sponsorJudah Gabriel Himango25-May-05 4:15 
Generalsave configuration Pin
dogdogdog24-May-05 21:20
dogdogdog24-May-05 21:20 
GeneralRe: save configuration Pin
Colin Angus Mackay24-May-05 22:26
Colin Angus Mackay24-May-05 22:26 
GeneralRe: save configuration Pin
pubududilena24-May-05 22:37
pubududilena24-May-05 22:37 
GeneralRe: save configuration Pin
J4amieC24-May-05 23:40
J4amieC24-May-05 23:40 
GeneralRe: save configuration Pin
pubududilena25-May-05 1:11
pubududilena25-May-05 1:11 
GeneralRe: save configuration Pin
DavidNohejl25-May-05 1:35
DavidNohejl25-May-05 1:35 
GeneralRe: save configuration Pin
dogdogdog25-May-05 16:57
dogdogdog25-May-05 16:57 
General.NET Executable as COM server Pin
mav.northwind24-May-05 20:59
mav.northwind24-May-05 20:59 
GeneralRe: .NET Executable as COM server Pin
John Fisher25-May-05 7:36
John Fisher25-May-05 7:36 
GeneralRe: .NET Executable as COM server Pin
mav.northwind25-May-05 14:34
mav.northwind25-May-05 14:34 
GeneralRe: .NET Executable as COM server Pin
John Fisher25-May-05 17:19
John Fisher25-May-05 17:19 
GeneralInsert Command Pin
Blue_Boy24-May-05 20:41
Blue_Boy24-May-05 20:41 
GeneralRe: Insert Command Pin
pubududilena25-May-05 1:27
pubududilena25-May-05 1:27 
GeneralRe: Insert Command Pin
Uri Lavi25-May-05 8:22
Uri Lavi25-May-05 8:22 
QuestionSerialization Error?? Pin
rufcaw24-May-05 20:27
rufcaw24-May-05 20:27 
MY program is supposed to send a file asychronously via TCP and sockets, to this end i grab

chunks of the file and store it in a data class, which i serialize and send.This is then

deserialized and the data block is placed in the correct spot in the file by offseting the

stream to the appropriate spot.

ok to the error , this process works the first couple of types with atleast the first 2

chunks of data being recieved and placed in a file on the other side. However after that

things go pear shaped, as once one goes wrong all the remaining chunks no longer work all

giving similar errors.

1 //<< this is my sequence number i use to find offset values
0 //<< current offset in file
got to reciever
got to tryrec
2 //<< this is my sequence number i use to find offset values
1024 //<< current offset in file
got to reciever
got to tryrec
A Exception occured in file transferSystem.Runtime.Serialization.SerializationException: The

input stream is not a valid binary format. The starting contents (in bytes) are:

6C-65-2E-52-65-61-64-4C-69-6E-65-28-29-3B-0D-0A-0D ...
at

System.Runtime.Serialization.Formatters.Binary.SerializationHeaderRecord.Read(__BinaryParser

input)
at

System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadSerializationHeaderRecord(

)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler

handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream

serializationStream, HeaderHandler handler, Boolean fCheck, IMethodCallMessage

methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream

serializationStream)
at SocketSystem.Program.MessageHandlerServer(CSocketClient pSocket, Int32 iNumberOfBytes)

in c:\documents and

settings\rob\desktop\socketsystem\socketsystem\socketsystem\program.cs:line 274
got to reciever

my data class
[Serializable]<br />
public class DropBear<br />
{<br />
//so this is where in the part belongs<br />
public int SequenceNo = 0;<br />
public string misc = "";<br />
//this is the data<br />
public byte[] buff = null;<br />
<br />
}


---------------------------------------------------------------------------

now for my serialization code

DropBear db = new DropBear();<br />
db.buff = buffered;<br />
db.SequenceNo = filt.currSeqNO++;<br />
BinaryFormatter bf = new BinaryFormatter();<br />
MemoryStream ms = new MemoryStream(); // Stream<br />
bf.Serialize(ms, db); // "Save" object state<br />
Byte[] by = ms.GetBuffer();

//data sent as Byte[] << byte buffer size 10240
//file chunk 1024

----------------------------------------------------------------------------

Deserialization
MemoryStream s = new MemoryStream();<br />
s.Write(pSocket.GetRawBuffer, 0, pSocket.GetRawBuffer.Length);<br />
BinaryFormatter bf = new BinaryFormatter();<br />
s.Position = 0;<br />
DropBear db = (DropBear)bf.Deserialize(s);


-------------------------------------------------------------------

the data is sent with a network stream, i have tryed resetting the buffer at the end of

every read and before every recieve

Any input would be appreciated.

Thanks Rob
AnswerRe: Serialization Error?? Pin
Alomgir Miah25-May-05 3:40
Alomgir Miah25-May-05 3:40 
GeneralBackground image in MDI container Pin
MJay24-May-05 17:59
MJay24-May-05 17:59 

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.