Tcp/ip - Consecutive Serialized Objects Not Deserializing?
Mar 28, 2009
This is my first post on here--I've been teaching myself VB via forums like this and MSDN for about 2 years now. I'm programming a computerized economics experiment, and I'm using a communications package that a guy I worked with developed. He and I have been going back and forth trying to figure out what the heck is going on.
The upshot of the communications package is that there's a serializeable MQMessage class that we send back and forth, essentially just a package of an integer (Type), string (Text), and Object (Data). Most of the time, this goes according to plan.
The problem is this: If the client receives two or more messages back-to-back, the client stops raising the MessageArrived event. (and presumably, the same would hold true for the server--I should test this, but jeez-oh-man, I've been running test after test for the last week).It's still connected, as on disconnect it throws the "Socket forcibly closed" exception. When it receives multiple messages sequentially, it's still receiving the data, it just never knows when the first message ends, and the buffer just keeps filling and filling. The problem seems to be that it can never successfully Deserialize the MQMessage object, and so it returns Nothing on the getCompletedMessage function and just keeps adding to the buffer (ABuffer.Length goes 1024, 2048, etc.).
View 1 Replies
ADVERTISEMENT
Jan 23, 2011
According to a mspress book (MCTS for Exam 70-536 .NET 2.0): You might have version compatibility issues if you ever attempt to deserialize an object that has been serialized by an earlier version of your application. Specifically, if you add a member to a custom class and attempt to deserialize an object that lacks that member, the runtime will throw an exception. In other words, if you add a member to a class in version 3.1 of your application, it will not be able to deserialize an object created by version 3.0 of your application.
Now... As curious as I am I went and created a project, serialized a class, added a new member and attempted to deserialize the class to the new object. To my surprise it worked and the newly created member was set to null by default (even if it had another default value).
[Code]...
View 3 Replies
Dec 27, 2011
I have used XML serialization to persist objects in my application but I am now interested in using null- able Data types for properties. Will I still be able to serialize?
View 6 Replies
Feb 24, 2011
I have a thought about using a Serializable Collection containing both data objects and also sub-collections as a low-grade database, meaning it's going to store data objects that are expected to be added to regularly and deleted from occasionally.
View 3 Replies
Jun 18, 2009
Changing datatypes of properties of serialized objects?
View 1 Replies
Jun 7, 2010
How can I send and recieve serialized objects over a TCP connection with size and data type values in the header (within array(0) and array(1) values)?I know how to serialize and send the object using BinaryFormatter.Serialize.I dont know how to take the recieved data and put it into an array of bytes().Also - on the receiving end I dont know the size of the object sent therefore I dont know when to stop reading the data stream so I cant use: Dim Obj As ClassName = DirectCast(BinaryFormatter.Deserialize(Stream), ClassName).
View 1 Replies
Jul 27, 2011
i want to check whether the dates in a file are consecutive.that is if the dates are 7.10,2011 ,7.11.2011,7.12.2011 it should return true and if they are 7.10.2011,7.12.2011 it should return false.
View 8 Replies
Jul 28, 2009
I'm writing a web crawler for a specific site. The application is a VB.Net Windows Forms application that is not using multiple threads - each web request is consecutive. However, after ten successful page retrievals every successive request times out. I have reviewed the similar questions already posted here on SO, and have implemented the recommended techniques into my GetPage routine, shown below:
[Code]...
View 4 Replies
Oct 31, 2011
I need to find consecutive numbers in an array and return a string which tells the range and numbers that don't form a range.I found some of the already asked questions but none of them is in VB.Net:Add to array consecutive numbersIf the array of numbers looks like {11,12,67,68,69,70,92,97} then returned string should be of the form 11,12, 67 through 70, 92 and 97.
View 1 Replies
Dec 9, 2011
The problem is to find if a word has 3 consecutive letters in it. Such as THIRSTY, STUDENT. Here's the code I've written, but I'm stuck on how to actually write the code to check the letters.
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
Dim word As String = txtWord.Text
[Code].....
View 19 Replies
Jul 18, 2009
I'm trying to load some data from a MySQL table and sort it so two equal rows doesn't come consecutive. I've been trying to do this on the server-side, but it looks like it's impossible. So I'm wondering if it's possible to load the data into a dataset and sort it there or something like that? I'm open for all solutions, both on the server-side and client-side.
[Code]...
View 3 Replies
Sep 29, 2010
This was a difficult question to google. I have an Order class with a couple of dozen properties such as ClientReference, ShipMethod, etc. I use databinding to bind this class to an Order form. If a user enters an invalid shipping method, an exception is raised in the ShipMethod property and a validation error is displayed to the user. But I'm trying to use the same Order class within an OrderImport class whose job it is to take a flat file and create multiple orders. The problem occurs if I'm assigning to a dozen of the order fields consecutively, and say the first one causes a validation exception. If I have all dozen assignments occuring within a single try-catch block, the next 11 assignments will be skipped and I'll only be able to record one validation error. I could solve the problem by doing a dozen separate try-catch statements, but that doesn't seem very elegant.
View 22 Replies
Nov 16, 2010
I am using VB.NET's TextFieldParser (Microsoft.VisualBasic.FileIO.TextFieldParser) to read a delimited file. However, when I try to read in a field with consecutive newlines within the field, the consecutive newlines are turned into a single new line. I would like the consecutive newlines to be preserved, but am unsure how.Here's an example file that I am reading in with exactly one field. The quotes are part of the file's content and there are three newlines (including the two consecutive newlines following line 2):
"This is line 1
This is line 2
This is line 4, which follows two consecutive newlines."Here is the code that I am using to parse and read in the file:
Dim reader as New Microsoft.VisualBasic.FileIO.TextFieldParser(myFile, System.Text.Encoding.Default)
reader.TextFieldType = FileIO.FieldType.Delimited
reader.SetDelimiters(",")
[code].....
View 1 Replies
Jul 18, 2011
I'm receiving the following xml string (i've removed the actual namespace name)
<?xml version="1.0" encoding="UTF-8"?>
- <changeNotificationDto xmlns="http://www.Company.com/item" changeEventTypeCode="RemoveDeliveryPoint" messageId="10" sentDateTime="1970-01-01T00:00:00.000Z">
- <entry action="Remove" type="DeliveryPoint">
- <removeEntityNotification>
[Code]...
View 1 Replies
Mar 2, 2009
I'm trying to make a multi-threading app which extracts the names from my site. I have 1000 pages celebrity related. The urls are on a listbox List1 and the number of threads are specified in TextBoxThreads I would like each thread take care of a coresponding url on list, when they finish go to the next one and so on (for each thread a url)
[Code]....
View 10 Replies
Apr 3, 2008
I am now trying deserialize my employee objects in my XML document into an instance of a class.Here is the class I wish to create an instance of:
Code:
Public Class EmployeeAdder
#Region "Declarations"
Private _ID As Int32 = 0
Private _Name As String = String.Empty
[code].....
View 4 Replies
Feb 16, 2010
I'm having problems deserializing some json data, getting InvalidCastExceptions and the like.
Can anyone point me in the right direction?
Here's the json i'm wanting to deserialize;
[{"OrderId":0,"Name":"Summary","MaxLen":"200"},{"OrderId":1,"Name":"Details","MaxLen":"0"}]
Here's my code;
[Code]...
View 3 Replies
Feb 5, 2011
I'm writing a solution in VB.NET that consists of a number of different components (UI manager, Outlook add-in, etc.). In the main UI program I'm serializing out an arraylist to a data file that contains the data the other components will need to do their jobs. That part works fine, and I can serialize and deserialize with no problem. Now I want to read (deserialize ) in the data in my Outlook add-in, and I ran into the dreaded 'Unable to find assembly' issue where it's looking for the original assembly that serialized the data. I found a hint for workaround
[Code]...
View 2 Replies
Feb 21, 2011
I have a WCF service defined as follows:
Imports System.ServiceModel
Imports System.ServiceModel.Web
<ServiceContract()>
[code].....
View 1 Replies
Apr 21, 2009
I have a Problem Serializing and Deserializing a 2-Dimensional Array. I have a 5x5 Integer Array and want it to format it into one String (like Base64) to store it as an Attribute in a XML-File.
To store it i use this code:
CODE:
To Read and Format it i tried following :
CODE:
But Deserialize only Returns an Integer not an Array. How i can Deserialize an complete Array ?
View 8 Replies
Mar 23, 2010
I'm saving potentially very large amounts of data to disk as a single serialized class. But there is a sub class that I would like to be able to retrieve and write back to the disk without having to read the entire file or write back the entire file. Trust me, my reasons for doing this are good, and the design behind this is more than correct.In VB6 this is very easily done. A single statement gets the portion of the data you want from the front of the file and saves it straight to the Type it belongs to, flawlessly. Likewise, if the dimensions of the data haven't changed, but only the values, then Put can be used to save it right back to the file without disturbing the integrity of the entire file.When needed, the entire file is read into a larger structure, and the entire file is put back, but only when necessary. Most of the time the only information being read from and written to the file are in the first few hundred kilobytes of the file.
Now that I've got serialization working, I'm trying to use it to read (deserialize) only the first member of the class serialized to disk. I haven't been able to find any examples of this anywhere that have lead me toward making the sort of progress I'm hoping for.So I suppose the first question is this: Is it possible to read only part of a serialized class from the open file stream? Specifically, in one case I want to read the first two integers stored in the class. In another case I want to read only the first block (sub class) from the open file stream. In both cases I do not want to read the entire file, but just what I'm interested in starting from block 0. I don't need to write back the integers to the first file, but I do need to write back the block to the second.Assuming that the answer to the above is yes. My second question would then be: How is this done? I want to work with the file stream already open rather than opening and closing file streams over and over.I
View 20 Replies
Oct 13, 2009
The following (abysmal) code demonstrates how standard serialize/de-serialize in VB loses the CR when on de-serialize. This can be overcome by applying 'XmlAttribute(DataType:="string")' to Description. Why does it do this? I would like to fix this without applying a 'LF' -> 'CR''LF' in every affected class. This is fixing a bug in existing XML files generated without the XmlAttribute!
Imports System.Xml.Serialization
Imports System.Xml
Imports System.IO
[code]....
View 1 Replies
Jun 17, 2011
I am having the same issues as per this question: WCF not deserializing JSON input..I am at a loss and desperate for a solution. I have scoured the net for answers, but I have found only this question that matches my exact problem. My datacontract parameter is also nothing when the service starts.I have tried the points of the answer in the question above, but they provide me with no clues (The web service executes OK -I am not getting any exceptions - and I can't see what the deserializer is doing - or not doing as the case may be).I am using POST, due to the size of the nested JSON.If more detailed information is needed, I will provide it on request.[code]
View 2 Replies
Aug 28, 2011
I'm developing a program that captures a bunch of information entered by a user on a tab form into five different structured arrays. I want the data to be saved into a single file and reloaded by the program into a similarly built series of structured arrays through a different form.If I understand the process of serializing collections right, I create a single ArrayList variable to capture each of the five Structured arrays.[code]
1. Do I have to declare one variable of the same type as the one in the first element of the ArrayList, or does having the public variable declared in the Class that's going to take this information already cover that?
2. Once I deserialize into the newly declared Rules ArrayList in the new form, is it a simple matter of setting the duplicated variables in the new form equal to the relevant element in the ArrayList? For example, if I have a new Public Roster As RosterDesc variable declared, can I set it equal to Rules(0) and it would automatically populate every element in the same order as they were created in the original form?
View 5 Replies
Dec 4, 2011
I am trying to deserialize a JSON string that looks like so: {'type':'clientlist','client_list':[]} I am using JavaScriptSerializer() to do it. For some reason the JavaScriptSerializer() is choking on the member 'client_list'. It doesn't give very good info. The error it gives is:
[Code]...
View 1 Replies
Jun 5, 2009
I'm not sure if i titled this question properly or am asking it properly, but here goes.I've got serialized objects (in XML) stored in a database, along with a string/varchar indicating the type.
[Code]...
View 3 Replies
Feb 25, 2010
In .NET (at least <=2) there's a problem serializing objects that raise events when those events are handled by a non-serializable object (like a Windows Form).Because of the way VB.NET implements events, when you serialize an object, its events get serialized too (because events are actually implemented using hidden multicast delegate fields). A side effect of this is that any object which handles events raised by the object being serialized will be considered part of the object graph and will be serialized too.
Some workarounds could be found, implementing custom serialization or using delegates instead of events:[URL]..
View 1 Replies
Dec 27, 2010
I'm building a simple game which involves many pictureboxes with which the player may collide. For instance, I'd have a hundred bricks spread throughout the level. In an old version of pacman I built in VB6 (and upgraded to .net), I implemented this like so: [Code]
As I understood, the brick(I) array exists thanks to the naming of the bricks, which ranges from _brick_0 to _brick_217 (as nowhere in the project a brick array is declared implicitly, at least not that I could find). I'd like to do the same in my current project, but even when I duplicate an existing brick it automatically renames it to "PictureBox123" instead of _ExistingName_NextID.
I saw a method of declaring a picturebox array and adding the bricks one by one, but since I have so many pictures this would best be avoided (especially due to the fact that not all pictures are bricks, so I cant just loop through every picture in the form). In short, my question is: How do I duplicate pictureboxes so that they'd be serialized in a way vb.net would interpret as a picturebox array? As you can see, i'm a really newbie to vb.net and wf in general, just started studying wf a couple days ago for my B.Sc and even that was accomplished with c#.
View 1 Replies
Feb 26, 2009
i would like to encrypt my data files, which are serialized object files. is there a simple way to do this that will work trouble free on both windows xp and vista?
my environment: windows xp pro (sp3), visual studio 2008 pro, (sp1, sdk 1.1)
View 2 Replies
Sep 26, 2011
I have created a class from an xml schema (that I do not own and cannot change) using xsd.exe. Using this class, I am deserializing to bring the data in to an object collection to consume. There are times when I want to take objects in memory and pass them to the class created by xsd.exe using a constructor I built to generate a serialiable object collection.
I cannot figure out how to format some objects correctly Example: In the xml file, there are certain simple types that are floats that come in with 6 digits of precision. When I write them out, they have 7 digits of precision. Anorther example is integers with leading zeros in the xml file. They come in as 4 digits regardless of leading zeros, but I can't find a suitable way using serialization to output them (other than to change the property to a string datatype.[code]...
View 4 Replies