Reading Data From A Socket (as Bytes) And Storing Data In A String?

Nov 29, 2009

I am reading data from a socket (as bytes) and storing this data in a string. Then later i need to access specific bytes within the string and do some math with them. However the bytes that I read back from the string are not what I am expecting.

[Code]...

View 2 Replies


ADVERTISEMENT

Communications :: Real Time Data Collection From Socket And Storing In Excel

Jan 5, 2012

I m into automation development of FMCG products using Micro-controllers. I get real time data Barcode 2D from TCP/IP connection. My task is to compare the result do some Computation with them and Store the incoming Barcode and results into a Excel sheet in a folder. I m successful with the basic working. Am currently working at slow speed of 1 barcode(22 char info) per second from the TCP/IP data (barcode scanner). Now, comes the real issue. I need to process atleast 5 barcodes per sec ( <200ms per process). I m partially successful with 3 Barcode per second(300 ms per process). so, thats like 300ms per processing. I need to achieve less than 200ms for entire processing. I have used threads and timers. but I m unable to achieve. Seems like storing in Excel takes more than 250ms. Since i come from micro controllers background 1msec is a lotta time to process for me. I m not sure how much time does it take and trust me i find it difficult to guage the time here.

View 1 Replies

TCP Client Error While Reading Data From Socket Server?

Apr 20, 2012

I have a TCP Socket Client (using the Socket Class) that is connected to a simple TCP socket server (just for testing)I have this code snippet :

Dim aSocket as Socket
While aSocket.Connected = True
byteRead = aSocket.Receive(dataByte) 'number of bytes

[code].....

View 1 Replies

Socket - BufferReadSize Is Filled With Space When Convert Bytes To String

Sep 9, 2009

The application is working good, i can receive data on port 48888 and i can write it to my logfile, but my problem is when i convert bytes to string. I have the correct data, but all the bufferReadSize is filled with space. Example: if i send only: test, my log file will have test and 4 lines of space only. In my code, right after Dim clientdata As String = Encoding.ASCII.GetString(bytes).

I tried to trim(), replaceI() or any string manipulation, and it's not working!%!? Is there anything i need to do before i can start manipulating that string?

View 1 Replies

Dont Get Any Data From Socket When Data Should Be There And No Exeptions Raised, Connection Is Open. Using DataAvailable To Wait For Data

Mar 24, 2011

I have a problem reading data from an RFID-reader. I connect to the reader by tcp and wait for DataAvailable to be true, then reading the data until I got a end of data character. Then I just go back and waiting for a new DataAvailable. This is done in a own thread for the function.

There seems to be some kind of timeout, If I don't got any data in a couple of minutes, then it just sits there in the do/loop waiting for DataAvailable. I hold the card to the RFID reader, it beeps, but there is no data available. I don't get any exeptions, and the information says that the clientsocket is still connected. Are there anything more I can check?

If I put the card to the reader in a minute-interval it seems as this will never occur. So 2-3 minutes idle:ing seems to do this.

Here are my code to read data from the socket, I have taken away some irrelevant code:

Sub test(ByVal ip As String, ByVal port As Integer)
' this sub is meant to run forever

[CODE]......................

View 1 Replies

Storing A Database Connection String Into Settings In A .net DLL Data Layer?

Mar 4, 2011

I've always used this approach while implementing data layer DLL for web application:

1) put datasets into the dll project
2) use a helper class with a method like this:

public shared sub settCnnStr(strconnhere as string)
My.Settings.Item("connectionString") = strconnhere
end sub

3) when I need to use the dll I call a method like this (usually into global.asax):

xxxxxxx.helper.setCnnStr("yyyyyyyyyyyyyy")

This method always worked for me nicely but I'd like to know if this method could have serious drawback or if there's a better solution.

View 1 Replies

VS 2008 : Storing Multiple Pieces Of Data In A Resource String?

Oct 24, 2009

In a resource string, not one that you declare in the code, but rather in the resources itself, how do I store multiple pieces of data in it?

View 7 Replies

Convert A Byte Array From Socket Into A String To Replicate - How The Serial Port Receives Data

Sep 21, 2010

I've inherited a tested function that processes incoming data from a .NET Serial Port. (Dim RXBuffer as string = serialport1.ReadExisting) I've written a different part of the application that processes a byte array as received from an asynchronous .NET socket.

Is there a way I can convert the byte array into a string as if it arrived from the serial port?

I would prefer to rewrite a very long 'if statement' into byte array functions syntax that look like:

dim b as boolean = IsBitSet(state_buffer(i), j) 'rather than:

dim b as boolean = (Asc(Mid(RXPacket.Pdu, CInt((i - (i Mod 8)) / 8) + 1, 1)) And CInt(2 ^ (i Mod 8))) > 0

View 3 Replies

VS 2008 Reading Webpage Source And Filtering String Data?

Oct 28, 2009

My program so far reads a certain webpage's source code and places it in a textbox. This much has already been accomplished.

Now I need to pick certain strings out of the rather large amount of text data and have the lines stored in variables, but the trick of it is, the exact string is unknown. The exact function should be, that the code finds certain tags from the source code, say <td> and </td> and takes the string data in between those tags, what ever it may be.

View 2 Replies

Reading A Blank String From Excel When Trying To Read The Header Of A Data Column?

Aug 25, 2011

I use an OLEDB connection to read from an excel database, and this loop to read in all of the data from each of the columns

While reader.Read()
For i As Integer = 0 To reader.FieldCount - 1
temp = reader(i).ToString + ControlChars.Tab
output_file.Write(temp)

[code]....

Some of the columns contain date information, which are read in fine (usually as a string "2/20/2011" or so), but the headers of those columns are read in as a blank "". The headers for all the other columns read in fine, but not for the date containing columns.

View 2 Replies

Continously Reading Data From A Modbus TCP Device And Store Data In A Textfile?

Mar 2, 2012

I have a modbus TCP device that I have managed to connected to through my VB source code.

I want to poll (continueously read) data from certain registers of the device, and store the polled data in a file (text,csv, excel).

View 1 Replies

Data Binding - Update The Grid Data By Reading The Array

Apr 2, 2012

Data binding should be an extremely simple thing to manage but I can't find a SIMPLE solution to the following problem.

I have two forms

Form1 contains a 4x4 MSFlexGrid (unfortunately an unmanaged COM object but I can merge cells, which I can't do with a managed Datagrid)

Form2 contains other controls which change the data in the Flexgrid.

I connect the two with a Public 4x4 array. Form2 changes the data in this array. I can update the grid data by reading the array. But how do I bind the Grid to the array so that it auto-updates - which is the whole point of binding isn't it?

View 5 Replies

Data Receiving With Socket?

Sep 27, 2011

i am working on 3rd party chat software, when ever i send data to server i get incorrect buffersize of data. like when i convert that data to hex to matching header for splitting data i got huge lengths data

in the above textbox of image i have got some 0000000000000000000.... with the hex data, how can i get only only original data. The code i have used to receive data is

[Code]...

View 1 Replies

Send Data With Socket?

Feb 21, 2011

I want to connect with a barcode printer and sendhim some specific characters and take back anything they send to me

[code]...

View 2 Replies

BitConverter - Sending Data Across TCP Socket

Apr 9, 2010

Given the following information
Public Enum Request As Byte
None = 0
Identity = 1
License = 2
End Enum
Protected mType As Communication.Request
mType = Communication.Request.Identity
Debug.Print (BitConverter.GetBytes(mType).Length.tostring)
2

Why does bitconverter report that mType is a length of 2. I would have thought that passing a Byte into BitConverter.GetBytes would just return the Byte. I mean it's no big deal because it's only sending a very small block of data across a TCP Socket, but I'm just intrigued why it thinks it's 2 bytes.

View 1 Replies

C# - Read A XML Data From TCP Port Socket

Jun 2, 2010

I have a device which send me data over a particular port. The data is in XML Format.

Now I already did a small console application which listen for the data and print out the data on the screen.

Now my plans are to deserialize the xml data or I will create the insert statement into the database.

1) The device send me the data every second (if there is data to send me).

2) I cannot say how much data the device is going to send me.

How can I make sure to capture all data without loose any information..

View 2 Replies

Get The Length Of Received Data Of Socket?

Mar 9, 2011

I built a server to receive data from clients.But how can I know the length of every data package.

Dim bteAcceptData(1024) As Byte
Dim myAsyncCallBack As New AsyncCallback(AddressOf ReceiveData)
intByte = EndSocket.EndReceive(pIAsyncResult)

[Code].....

View 2 Replies

More Than One Data Transaction Using Socket Programming

Oct 28, 2009

am developing an application where a client send data to server (socket Programing) and the server recevices it and shows it to the user through a list view but the client can send the data any time they want and it should show on the list view automatically... So i have put a timer and in tick event i have written the code like this the below code is working fine in onload event but then only once the client can send the data to the
server.

[Code]...

View 3 Replies

VS 2008 - Add 5 Bytes Of Data At The Beginning?

Oct 21, 2009

I have some questions about arrays.

1) Lets say I open a file in a byte array and I need to add 5 bytes of data at the beginning. How would I go in doing that? ex: attaching to arrays together.

2) How would I go in adding 1 byte of data in a bye array?

All i need to do is open part of a file in bytes. Add a letter and 2 numbers to it at the begging and a number at the end.All i need to know is how to attach 2 byte arrays together and how can u add a byte of data to an array.

View 7 Replies

.net - Grid For Storing Data?

Jun 2, 2011

I need to store data in a grid like this:

{0,1,2,3}
{4,5,6,7}
{8,9,10,11}
{12,13,14,15}

I know I can use multi dimensional arrays, but Is there any easier way to do it? Also I need to get values from it like myData.Item(0,1) would return 1.

View 1 Replies

Storing Access 07 Data On VB 08?

May 2, 2011

I've linked the two using the standard data sourcing method and I now need to use the data that is read in to it on another form. The idea of this is that I'm creating a wage calculator and the employees are stored in a database and can be viewed on a vb form, however, I now need to use the data of their pay/hr to be used on another form to calculate the wage.I have tried to declare a public variable across the two separate forms, and on the button that takes you to the other to set this variable as the contents of the text box which is displaying the pay/hr using the following

Public Class ManageUsers
Public HrlyRate As Decimal 'Declaring global variable to use between forms

'Some other code in between relating to rest of the stuff on the form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RatePerHourTextBox.Text = HrlyRate 'Saving private variable to global variable
Calculation.Show()
End Sub
End Class

Then on the other form I have used this code to do the calculation:

Public Class Calculation
Private Sub calculation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub

[code]....

View 2 Replies

Storing Data In An Array

May 15, 2009

I'm having trouble trying to put together some code for an array. What I'm trying to do is get data entered from a text box and store it in an array.What I then need to do is take the entered data and make it appear in reverse order to what it's been entered and show this.

View 6 Replies

Storing Data In Arrays?

Apr 22, 2011

storing data into an array. I understand how to place information in one record eg in index 0, but how do i place data into several records(indexes).

View 4 Replies

Storing Data In Classes?

Apr 25, 2012

I have propetie get set classes, and a constructor to quickly set them all.The only concern I have is that the byval in the constructor class and the byval in the set() properties, might be inefficient because the parameter is copied twice? Should I use ByRef? Or is that too dangerous?

'Config data for an Environment.
Public Class Environment
Private msEnvName As String

[code].....

View 6 Replies

Storing Data In Listview?

Jun 23, 2011

I'm trying to learn visual basic and i've made my application all work and now I just need to make the listview save data.As far as I know, I can create a database with all the relavent tables in it for each column in the listview. For example in a database, I will have a table that will have four columns because I have a four column listview. Each row must be tied together though.

The other option is to create a text file and use some xml or seperate them with commas. which one should I go with? I'd rather do the database one, but I really have no idea how to go about it.

View 4 Replies

Storing Data Into Microsoft SQL?

Jul 5, 2010

How can i store data accquired from an Ip address within the LAN into my database?

View 3 Replies

Temp. Storing Data In ASP?

Mar 23, 2011

I have a question. I have a asp site that keeps track of inventory. I currently have it as to where any updates to the inventory, an email is sent with the new changes. How can I get it to send the old changes and the new changes. I know I will need to somehow temp store the old values to use them in the email, but I can't figure out how to do it. I don't want to store them in an actual database table.

View 1 Replies

VS 2008 Storing Data?

Jan 12, 2012

is there any way to keep data stored in an application retrieved from web references like we get data [items] invoked in a listbox from web references and then after publishing it when once exe. is run the data is invoked or retrieved from web references. so that when next time once again exe. is run the retrieved data will be there instead of waiting services to get data.

View 13 Replies

.net - Socket Communication - Unusual Data Being Received

Feb 24, 2011

I am trying to communicate to a local AS3 Air app on my PC via sockets. The VB.Net app is acting as a server in this case while the Air app is a client. The .Net app sends data every 25ms to the Air app. I have not send any message termination. I just receive the data on Air app and process it.

[Code]...

View 2 Replies

Communications :: Parsing Data From Binary Socket

Sep 7, 2008

I am using VB.NET and I am designing a generic network architecture in which data can be transmitted in various ways. I am wanting to strip down things as much as possible, and I do not want to transmit in plain text. My question today is regarding ideas and example code (if applicable) as far as parsing binary data that is sent over the wire in VB.NET.I want each packet to have a very generic architecture such as <packet type> <address> <payload> or whatnot. I understand that I can use certain bytes as delimiters for these packet fields. I don't necessarily want to serialize everything being that for security reasons, the same library has to be used to deserialize the data.

a) Put my protocol into binary data where each field is delimited using a certain byte

b) Parse that data from binary at the other end.

Once again, I don't want to use plaintext since this can cause a bunch of overhead in comparison.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved