serialization

send a serializable object over socket

情到浓时终转凉″ 提交于 2019-12-25 18:14:57
问题 I have a strange problem to send a serializable object that I have created over socket. In fact if I run the server and the client in the same machine it works well but if the server and the client are in different machines the readen object in the server side is empty (with size equal to zero) Any one have an idea to fix that ? (the code is bellow) Server: public static void main () { ... InputStream is = mysocket.getInputStream(); ObjectInputStream ois = new ObjectInputStream(is); ArrayList

Trying to deserialize more than 1 object at the same time

南楼画角 提交于 2019-12-25 17:16:10
问题 Im trying to send some object from a server to the client. My problem is that when im sending only 1 object, everything works correctly. But at the moment i add another object an exception is thrown - "binary stream does not contain a valid binaryheader" or "No map for object (random number)". My thoughts are that the deserialization does not understand where the stream starts / ends and i hoped that you guys can help me out here. heres my deserialization code: public void Listen() { try {

(de)serialising Nested Generics in Jackson

十年热恋 提交于 2019-12-25 15:15:17
问题 So I am seeking to deserialise and serialise an object using Jackson. The object has a hierarchy, and deep down in the hierachy there is a List<T> where T is either a String, or one of the Java number classes. Deserialising generic lists has been a common topic on these forums, and I know how to build a mapper that will deserialise or serialise a list using mapper.readValue. What I don't know how to do is make is so that when I call the mapper on the top level, which doesn't know explicitly

Can you add additional properties to .NET serialized NULL values?

杀马特。学长 韩版系。学妹 提交于 2019-12-25 12:55:48
问题 In .NET, you can serialize a nullable element using XmlElement( IsNullable = true ), which results in this: <SomeElement xsi:nil="true" />. However, I need to be able to add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance after any field that is being nulled out. Example: <SomeElement xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> Is this possible? 回答1: I figured it out. Here is the answer: [XmlElement(IsNullable = true, Namespace = "http://www.w3.org/2001

Examples of using cereal serialization and boost::asio?

孤者浪人 提交于 2019-12-25 12:14:19
问题 I'm trying to serialize objects/messages and send them as UDP packets between nodes. I'm currently looking at cereal for serialization and boost::asio for actual network programming. Are there any examples of using these two libraries together, even if it's pseudocode? 回答1: You can treat any example of Boost Serialization with Asio as the pseudo code example. Despite some differences, Cereal is similar enough to Boost Serialization for the samples to be relevant. Straight forward: sending

Examples of using cereal serialization and boost::asio?

折月煮酒 提交于 2019-12-25 12:14:03
问题 I'm trying to serialize objects/messages and send them as UDP packets between nodes. I'm currently looking at cereal for serialization and boost::asio for actual network programming. Are there any examples of using these two libraries together, even if it's pseudocode? 回答1: You can treat any example of Boost Serialization with Asio as the pseudo code example. Despite some differences, Cereal is similar enough to Boost Serialization for the samples to be relevant. Straight forward: sending

tcp server only receives the first packet

给你一囗甜甜゛ 提交于 2019-12-25 12:07:29
问题 I am building distributed game using java based on tcp protocol.When I send multiple packets from one client to the other one, the receiving part only gets the very first packet again and again.Could anyone give any hint? Thanks beforehand. Here is the code in receiving side: Note MazePacket is a class which implements serializable MazePacket packetFromClient; /* stream to write back to client */ ObjectOutputStream toClient = new ObjectOutputStream(socket.getOutputStream()); /* stream to read

Can not pass Serialized object from android to C# web Service

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 11:56:30
问题 I want to send an object from android app to c# web service by ksoap2. The webService method get a ReceptionCommitItem object. this object defined in C# webService as blew : [Serializable] [XmlType(TypeName = "RCI")] public class ReceptionCommitItem { [XmlAttribute(AttributeName = "Id")] public int ReceptionNumber { get; set; } [XmlAttribute(AttributeName = "St")] public ReceptionStatuses NewStatus { get; set; } [XmlAttribute(AttributeName = "PRN")] public string PartRequestNumber { get; set;

Serialising my class is failing because of an eventhandler

旧时模样 提交于 2019-12-25 11:56:20
问题 I wasn't expecting to come across this error. I imagine I'm doing something wrong somewhere else. I have an MVVM application. My model can serialise its self using a BinaryFormatter . This was working fine. Today I added in an event handler to my model, and the viewmodel that contains the model subscribes to this event. Now when I try and serialise the model I get an error because my viewmodel isn't serialisable (by design). I am sure it's down to the subscription to the event, because I've

Serialize table tr data?

ぐ巨炮叔叔 提交于 2019-12-25 09:52:07
问题 I'm serializing my form using : formVals = $('#formID').serialize(); But I also have a table that I'd like to serialize and add it to formVals Can that be done? I've tried : $('#tableName').find('tr').each(function(){ formVals = $(this).text().serialize(); }) But that results in Uncaught TypeError: $(...).text(...).serialize is not a function What I want to do is take the text from each tr and add it as a new entry to formVals along with the exiting date. Is there way to do this? UPDATE A row