Basically, I need to transmit data across a network from point A to point B using a Binary Serialization System. I'm doing this to make sure that the system can't have outside listeners read the data being sent easily and to keep results secure and confidential.What is an easy way that I can encrypt, say, a generic object? Would it be easiest to serialize it to file, read the bytes in, encrypt the bytes, then store the bytes in a serialized structure and send that across the stream and reverse the process?
Private Function EncryptClass(ByVal obj As Object) As Byte()
Dim key() As Byte = {52, 15, 85, 150,
45, 12, 78, 120,
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
But on the receiving end I dont know the size of the obejct sent therefore I dont know when to stop reading the data stream. I also dont know how to take the recieved data and put it into an array of bytes().
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)
<Serializable()> Public Class GOODownloadFile Private aID As String Private aDownloadLink As String
[code]....
Now when I create an object like this
Dim f As New GOODownloadFile("http:\download.com1.exe", "c:Down", "c:Down") downloader.AddDownloadFile(f) downloader.WriteInfoFile("C:1.txt")
All the values given are correctly saved in the file 1.txt But when I change the download file info afterwatds, like this:
Dim f As New GOODownloadFile("http:\download.com1.exe", "c:Down", "c:Down") downloader.AddDownloadFile(f) downloader.WriteInfoFile("C:1.txt")
[code]....
the new value (123456) is not saved. Hence, only the values provided BEFORE the AddDownload are saved, the rest aren't. I've check my code 100times, and I'm sure everything is fine. I think it may be because of the send-by-value. When I change the values afterwards, the orginal object isn't used.
I'm trying to send a XML serialized class over a network stream
the send is working
Dim IP As Net.IPAddress = System.Net.IPAddress.Parse(IPAddress) Dim IPE As New Net.IPEndPoint(IP, 10003) Dim TCPClient As New Net.Sockets.TcpClient
[Code]....
I always get an error {"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."} The XMLFile has the xml document in it most of the time and I can go on and everything works but 1 out of every 5 times it doesn't work at all and the XMLFile contains nothing ..
I have a serializable Message class that has a Data As Object property that I'm using as a generic holder for information to be sent via a system that uses a combination of push technology and/or IPC to communicate with any other programs that are interested in the information. This allows the communication piece to be agnostic of the information it transmits.
I was serializing this Data As Object as a Byte[], since I was worried about how an Object being serialized and transmitted across the network would behave on the other side. However, when deserializing I get errors about being unable to find the assembly for the types stored within my Data As Object property, because I'm deserializing in the assembly that contains the Message class... not the assembly that contains the type that Data As Object originally was.I was wondering if I'd lose the type information and be unable to cast it back to the type I want at the other end. Perhaps it's not possible to pass a type as an Object via another assembly without it knowing about my type?
Im making a desktop player for a online web radio, and for the program I wanna make it show all the stream info. Like the stream name, and such. However I dont know how to do this? I looked everywhere
The server url is setup like this "[URL]" And it has all the stream info and that there. So is there a way I can get the info from there onto like say a label? Live updates btw.
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:
Public Shared Function AESFileEncrypt(inputFilename As String, outputFilename As String) As Boolean
'Create SymmetricAlgorithm object and specify the Key and IV. Dim AES As RijndaelManaged = New RijndaelManaged
[CODE]...........
This happens with large files. I gather that I have to use a fixed size buffer and read the file in small chunks, copying those chunks from the input to the output stream, until I reach the end of the input file.
I've been messing around with cryptography lately and wanted to figure a way to encrypt an exe so it's not runnable then decrypt it back to it's original state. I found a tutorial online that teaches how to do this with a text file so I figured I'd just tinker with that and try converting it for use with executables. For some reason though after I decrypt the encrypted version it doesn't run and gives me the error:^I'm running 64 bit windows but I'm pretty sure this wouldn't work on an x86 system either.
Imports System Imports System.IO Imports System.Security
I am creating a UserControl with rich design-time support that should eventually look like the Options window in Visual Studio (or many other applications). Basically a split container, to the left is a TreeView with 'option categories', and each node in the treeview corresponds to a 'panel' to the right with certain options.
Just for terminology, the nodes in the TreeView are OptionsNode objects, the panels (containing the controls that determine the options) are OptionsPanel controls. My UserControl itself is called OptionsView and is the control that contains the treeview as well as a panel that contains the OptionsPanels.
I have some experience in design-time coding, and I have gotten pretty far. The OptionsView control contains a property Panels that returns the ControlCollection of the right side of the split container. The user can add/remove OptionsPanels via this property (and automatically an OptionsNode is created). The property uses a custom CollectionEditor that tells the designer to create instances of type OptionsPanel (instead of just Control which is the usual collection type of ControlCollection). Furthermore, in the CreateInstance method I use the DesignerHost object and its CreateComponent method to create the panels, instead of just creating New OptionsPanel objects. This way the OptionsPanel created is selectable and editable (via property grid) during design-time:
vb.net Protected Overrides Function CreateInstance(ByVal itemType As System.Type) As Object If itemType Is GetType(OptionsPanel) Then
I am attempting to read from a url into a System.IO.Stream object. I tried to use
Dim stream as Stream = New FileStream(msgURL, FileMode.Open)
but I get an error that URI formats are not supported with FileStream objects. Is there some method I can use that inherits from System.IO.Stream that is able to read from a URL?
So i'm still goofing around with this chat app thing. Current when a user sends a message it sends to all clients connected. The server stores all clients and their IPs in a hash table, so what i want to do is each time a client joins, the server will broadcast the updated hashtable to each client. I know i can make a mess and get the server to broadcast each row of the hash table as a string but i think this way would be cleaner, either that or send the client object instead of the whole hash table.
I am generating an Excel file upon a click of a button in an update panel. It is throwing a parsing error.If I keep the button outside the update panel it is working fine. Why isn't it working in the update Panel?
in an winForm app in VS2010 win 7 compiling to x86, I try to do what Alvas.Audio seems to work. See (c# ex: [URL] for reference.
Dim data() As Byte = wr.ReadData(second * i, second)
The result give me data.length()=0. I do not have any exception, I can read format from it and whatever reader I use I got this problem.EDIT : After some tests, it seems like the uncompressed file I create in the first step (in PCM format, with .wav extension) can not be recognized by the Alvas.audio library for the second step. I must miss something around Audio file markups or something alike.
Here is the code that might be the source (basically this is step 1):
Dim functOut As String = String.Empty Dim wr As Alvas.Audio.IAudioReader = Nothing Dim fs As IO.FileStream = Nothing
[code]....
How can I write the resulted stream to be sure I can read it again later?
I am successfuly connecting to an FTP server and have no problems with uploading / downloading files and initiating general file transfers. However, when attempting to list the directory I get a strange exception and it seemed to just start happening of its own accord.
Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'. This is confusing! I am certainly not manually disposing any of the connection of stream reader objects, nor am I disposing anything else in this entire sub routine. On setting breakpoints, it seems that the array list is filled correctly but then the error fires when the status code is 226 despite me clearly specifying that the while loop should not run under these circumstances. (226 is equal to FtpStatusCode.ClosingData)
I'm trying to find source code for vb.net(2010). i want to stream video file (picture and sound) from my computer(server) over lan to another computer(client). on the server side i open the video into "Windows media player controller". how i stream the picture and sound over lan network?
im trying to get a memory stream to a textbox, the memory stream is of a .txt or .ini file that is extracted from a archive to a memory stream.Heres what ive got so far:
vb Dim MSData As New System.IO.MemoryStream() Dim Infile As String = ComboBox10.SelectedValue 'The input archive Dim passww As String = TextBox1.Text 'Archive password Using extr As New SevenZipExtractor(Infile, passww) extr.ExtractFile("02.ini", MSData) End Using Dim sr As StreamReader = New StreamReader(MSData) Dim textSsS As String = sr.ReadToEnd() ini02.Text = textSsS
I am trying to capture a stream from a website into my vb.net application. I was able to do it before, but the site is now updated and I cannot play the file again!!!ere is the link:I tried using several methods. looked at the source, flash capture programs, even fiddler to check the requests, but it didn't work at all
I was taking code called from an event and making a function of it
Public Function asyncPostMS(prefixes() As String, ms As MemoryStream) As Stream Dim request As WebRequest = WebRequest.Create(prefixes(0)) request.Method = "POST"
[Code]....
Now when I call this using the new function the stream is already closed. How do I pass out a stream object from a function as an already "read" object.
Or do I need to create the stream outside the function?
I have a Socket application that, when data is received (on the Server side) and the client is recognized, the data is passed onto its own socket and stream, and the previous socket and stream is discarded.
The data is serialized with a binary formatter before sending and deserialized on receiving the data.
is this possible to do in memory (so i can get rid of any disk IO)?:
If File.Exists("c:MyImage.png") Then File.Delete("c:MyImage.png") End If
[Code]....
This above code works great the first time then errors out on any successive attempts after that with the file being used by another process at the File.Delete line. The image is being generated for use as a mail attachment and i've only ever done it via a phyical file on the disk.
I have a user interface app that allows you to drag/drop in files - and it turns them into HttpListener request POST's to another EXECUTABLE that I have running - let's call it BACKEND1. BACKEND1 will be running on a SERVER when this gets ready for production use. Lots and lots of users running the UI - all dragging in files - all getting POST'ed to BACKEND1 - with the file included as a memory stream in the POST. BACKEND1 responds to the UI with a "sequential" file number assigned to the file centrally on the server.
On the SERVER is also running another EXECUTABLE - let's call it BACKEND2. It's job is to work with the DRAG'd in files. Both BACKEND1 and BACKEND2 sit on the same SERVER. At the moment I am writing the memory stream to DISK in BACKEND1 - and POSTing the FILENAME to BACKEND2 for it to work on. Would it be better to not write the file in BACKEND1 but instead include it in the POST to BACKEND2 - where it can be written to DISK? Is having LARGE HTTP REQUEST's a burden when sent between two EXECUTABLES on the same machine?
My primary goal is to have a really available BACKEND1 talking the the UI instances running out in the world. I'm concerned that doing the file i/o in BACKEND1 is "expensive" - and I don't care about the performance of BACKEND2 as much. just looking for opinions. I guess ultimately I'll have to bench mark this myself in a production environment to get a real answer.
I have a user interface app that allows you to drag/drop in files - and it turns them into HttpListener request POST's to another EXECUTABLE that I have running - let's call it BACKEND1.BACKEND1 will be running on a SERVER when this gets ready for production use.Lots and lots of users running the UI - all dragging in files - all getting POST'ed to BACKEND1 - with the file included as a memory stream in the POST. BACKEND1 responds to the UI with a "sequential" file number assigned to the file centrally on the server.
On the SERVER is also running another EXECUTABLE - let's call it BACKEND2. It's job is to work with the DRAG'd in files.Both BACKEND1 and BACKEND2 sit on the same SERVER. At the moment I am writing the memory stream to DISK in BACKEND1 - and POSTing the FILENAME to BACKEND2 for it to work on.Would it be better to not write the file in BACKEND1 but instead include it in the POST to BACKEND2 - where it can be written to DISK?
Is having LARGE HTTP REQUEST's a burden when sent between two EXECUTABLES on the same machine?My primary goal is to have a really available BACKEND1 talking the the UI instances running out in the world. I'm concerned that doing the file i/o in BACKEND1 is "expensive" - and I don't care about the performance of BACKEND2 as much.
I have a problem with the cryptostream, if i write the stream to a memorystream the memory that the stream used is still alocated and i have no way of unalocating it.what am i missingdoing wrong? im using-using on the streams,readers and crypto stuffs so the framework should shut them all down right? i tryed calling .close and .dispose but nothing ,in fact i moved it all over I have provided the sub that im using for the encrytion im in .net 4.5 so there is a lil async stuff but i know thats not the problem coz i moved this code out of my main app(.net 4) for testing to see if i could fix the problem.[code...]