Thanks, guys... I will try these ideas.
dwebster
Posts
-
Setting System Time -
Setting System TimeDoes anyone know the best method to use to set the system time using C#? I am looking for the best way to programmatically set the time on my computer. Thanks!
-
Serialization/Deserialization Using SocketsActually... Program A (the client) is sending to program B (the host/server) and program B (the host/server) winds up having a larger buffer than program A (the client). Also, remember that the buffers are just fine when using Dns.GetHostName() rather than www.anywhere.com to obtain the IP Address... there is some difference in sending the buffer via sockets to the localhost versus sending the buffer via sockets through the internet (using DNS to resolve)...
-
Serialization/Deserialization Using SocketsI added code to write out a file of the buffer prior to sending from the client. I also wrote out a file of the buffer received on the host/server via the socket connection. The buffer on the host is larger than the client buffer. I am investigating the differences now... any clues?
-
Serialization/Deserialization Using SocketsI am using async sockets: private void SendBinary(Socket sock, byte[] buffer) { sock.BeginSend(buffer, 0, buffer.Length, 0, new AsyncCallback(SendBufferCallback), sock); } private void SendBufferCallback(IAsyncResult ar) { Socket sock = (Socket)ar.AsyncState; int nBytes = sock.EndSend(ar); sendDone.Set(); } I can try to serialize it to a file on the send and receive sides and see what the differences are... if I find differences (which I should), then what do you think the problem is?
-
Serialization/Deserialization Using SocketsI have two programs, A and B... program A serializes some data into a buffer, attaches via a socket connection to program B, transmits the serialized data via socket to program B, program B then deserializes the data and all is fine. This process works great if programs A and B communicate on the same machine using the following code to obtain the IP Address: m_ipHostInfo = Dns.Resolve(Dns.GetHostName()); However, if you obtain the IP Address in this manner: m_ipHostInfo = Dns.Resolve("www.anyplace.com"); ... the deserialization fails in program B, complaining about an invalid header or object version difference... The data is indeed making it from program A to program B by resolving the DNS for the domain, it just seems like it is getting corrupted in some way. Any suggestions? Thanks!
-
SerializationThat works very well... thank you very much!
-
SerializationI am having a problem with serialization and deserialization of classes using the BinaryFormatter. I have two different programs and I want to serialize a class in the Test1 program and transfer it using sockets to the Test2 program and deserialize it into a replica class. When I attempt to deserialize in the Test2 program, I get the following System.IO.FileNotFoundException: File or assembly name Test1, or one of its dependencies, was not found. Here is an example of how I am serializing: SomeClass sc = new SomeClass(); sc.var1 = 12; sc.var2 = m_strTemp; BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); bf.Serialize(ms,(object)sc); After receiving buffer of serialized data, here is an example of how I am deserializing: BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(buffer,0,nBytesRead,true,true); SomeClass sc = (SomeClass)bf.Deserialize(ms); What am I doing wrong? How can I deserialize in an entirely different process, in a different program, on a different machine and not receive this error? Thanks! Donald