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
ADVERTISEMENT
Sep 28, 2009
I'm writing a GUI-based app in VB.net that talks to a LambdaMOO server via telnet, sends commands to display the object hierarchy, then parses the output and creates a visual representation of the object hierarchy.So my question is: is there some kind of "telnet client" class for .NET to simplify the sending and receiving of data, or do I have to write my own using the socket API?
View 7 Replies
Feb 20, 2010
A friend and I are working on a project where we're required to build a reliable UDPclient/server using VB.Net. We have things working well, but one thing that still eludes us is how to dynamically allocate a (byte) buffer for the incoming data. Right now we have to hard code a maximum value/MTU (or use a really large buffer size and resize it once we've finished receiving). Does anyone know of a way that this can be done without needing to specify the receive buffer size?
Basically, before calling the receive function on the socket with a buffer of size x, we want to know x so we can allocate an appropriately sized buffer. Perhaps this is a problem in all socket programing that you just have to deal with??
View 1 Replies
Aug 17, 2011
I am making a java chat server, and a guy was able to connect to it no problem (however, he logged off for the night before I ran into any problems, so I couldn't see what he did). Here is my code on the VB form:
[Code]....
View 5 Replies
Mar 6, 2011
I'm running into an issue where I have a lot of AsyncSends going on with dozens of client sockets, and at the moment if any remote client stops receiving but doesn't actually disconnect, the app quickly eat sup all of the SocketAsyncEventArgs (aka an sae) I have preallocated because they're not released since the SendAsync is not completing. The obvious solution to this is to implement a per-client send queue, which sounds easy enough but I am unclear as to the specifics. I have one sae allocated per client to receive, which works perfect, and ideally I'd love to allocate a single sae to the client's async sends.
I understand popping in and asking a question that is veiled request for a 'give me code' solution is looked down upon, but I honestly have not been able to turn up a lot, either on the .XAsync methods, which Microsoft has a horribly poor example for, nor for a send queue in general.
Edit for @J.N.
I forgot to mention it, but I -am- actually using a bunch of preallocated sae's stored in a managing class that internally uses a ConcurrentBag. With one connection, in a test scenario where 20 small messages are sent per second (this is slightly more than double how many messages would actually be sent in the production server), the server eats up 500 preallocated sae's in a few seconds. If I implement 'create if empty' code, the sae count quickly climbs into the thousands.
I understand the functionality that the async methods of the Socket class provides, but if there's a network hiccup or something similar, this issue will outright bomb the server within seconds. A send queue sounds like an great solution, but I have no idea whether it's a good idea to do in a high performance production environment or not.
The base problem remains, though, that with a dozen messages per second per client being sent out, any network congestion or other factor that lags the connection but does not disconnect it will quickly deteriorate into a laggy mess.
I think a solution I might be looking for is something that locks up the single sae being used for sending until the completion callback is reached, where that sae is then unlocked and then reused to send any pending data. The actual implementation of it eludes me though.
View 1 Replies
Sep 19, 2010
I need to control a device with a GPIB port. I have the commands that I need to use to do this; but I don't know which is the sintaxis in Visual Basic.
For example if I need to send a instruction like "START:0.01" to the external device which are the libraries that I have to include?, how should I write the programming line to do this?
The main tasks that I need to program are sending data, receiving data, and saving data
View 5 Replies
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
Apr 19, 2011
I have a small program which is a tcp client. I send a string from this client to a device over ethernet (it acts as the tcp server). As soon as the device recieves the input string it will respond back with response data. My problem is i am not getting the entire response data back from the server. (device).
Dim serverStream As NetworkStream = clientSocket2.GetStream()
Dim outStream As Byte() = System.Text.Encoding.ASCII.GetBytes("my-cmd")
serverStream.Write(outStream, 0, outStream.Length)
[code]....
View 4 Replies
Mar 23, 2007
Actually my project is based on rfid. The transmitter sends data to the remote reciever that is attached to the pc through USB. Now i have to design a VB.net interface for the recieved data.I dont know how to program and get data from USB and utilize it. I only have to receive the data and not to send.
View 14 Replies
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
Nov 11, 2009
Im woundering how does Receiving/Sending data work in a TCPClient/Server that is connected in the same networkstream.
View 4 Replies
Nov 14, 2011
Currently I had write a simple VB code, my aim is when i click "Forward" button then the vb will send a character "A" to PIC, "Reverse" button will send "B" so I write my vb code for sending as below:
Dim Forward As Char = "A"
SerialPort1.Open()
SerialPort1.Write(Forward)
For the receiving part, after I received the data from PIC then I will show it at the label which act it as a screen. the receiving code as below:
SerialPort1.Open()
receive = SerialPort1.ReadChar()
If receive = "A" Then[code]....
View 14 Replies
Dec 4, 2011
I am working on system support for an electronics project wherein I have to receive an 8 bit (binary) data through a USB port and store either the binary or the corresponding decimal into a variable. How can I implement this in visual basic 2010?
View 11 Replies
Dec 6, 2009
I have made this code:
Dim tcpClient As New System.Net.Sockets.TcpClient()
tcpClient.Connect("usuarios.lycos.es", 80)
[Code]...
View 4 Replies
Apr 24, 2012
there is a complex situation wherein, I have to pass a string data to a .exe application and this .exe application would process the string and respond back to my php data. I prefer not to use a TCP/IP connection.
View 1 Replies
Jan 8, 2009
I got a CRC checksum now and I get a Message in this Format SOH, Length Of Incoming Message, Message, CRC Checksum So I have a nice little look to processes the message and everything, Now I have questions on two events, While this loop is running it awaits for Data on the wire to come through and Checks for the SOH, I always get that but what are the chances of NOT getting a SOH, and if I don't what should I do with the Buffer Dump everything Till I come to another SOH? And on another scenario If two Packets are clashed together in one buffer should I always try to Peek and see if the Next byte after the CRC is a SOH to see if there is more Bytes and an whole another command to start Parsing and then take action?
View 4 Replies
Dec 11, 2011
I'm using the following code to get newsgroups from a server[code]...
When I execute the code, the routine only receives one block of the data. However, if I go into debug mode with a breakpoint at the loop instruction, I receive all of the blocks of data.Am I missing something in the code, like a wait or something, that would allow the program to receive all data like happens with the debug?
View 1 Replies
Dec 8, 2011
I'm using the following code to get newsgroups from a server:
sendBytes = Encoding.ASCII.GetBytes("LIST active microsoft.public*" & ControlChars.CrLf)
networkStream.Write(sendBytes, 0, sendBytes.Length)
[code].....
View 2 Replies
Nov 30, 2008
i was not getting o/p properly when i tried to receive data from serial port using the following code.
Public Class form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If SerialPort1.IsOpen Then
[code]....
View 4 Replies
Jul 1, 2009
I am making aproject in vb6 with MScomm. Computer A connected with a device on serial port. I can receive the data from serial port in a text box. Computer A can also dial cmputer B to make connection. But it is unable to send data on modem or computer B is unable to receive data from modem.Here is the code for sending and receiving computers1- Computer A
Option Explicit
'button to open data port to receive from device
Private Sub cmdOpen_Click()
[code].....
View 3 Replies
Dec 13, 2009
I have a program that receives serial data from a microcontroller and displays it.If I use windows terminal I get the right data.For some reason my program is not displaying the right data.What is sent is temperature.So the actual data is 24 degreesC and my program is showing 10 degreesC.
Private
Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived
[code]....
View 8 Replies
May 21, 2011
I wrote a Socket Client which will send the Socket Server some data and get some response from Server. This process will be running once in every 2 seconds.
Now what I need to know is How we can identify the connection lost between Server and Client?
I need this to be implemented in the Client side. If there is no connection then Client should automatically close the connection. Once the connection with the server is available in the next attempt it should connect automatically.
View 1 Replies
Jan 23, 2009
I am working on a client/server application. Everything seems to go well for a while (a few hrs, a few mins its kind of random) then suddenly clients stop receiving data. maybe 1 or two, or all of them. in the end I end up having to restart the server piece to resolve it, but I am trying to understand why its doing this. I've added try catches around the send piece, but it doesnt error out. When the app fires, the listener is started on its own thread. When a new connection is made, that connection is passed to a class that handles all of my connection data(send/receive, responding to commands, etc). The class is started in its own thread, so each connection is running in its own memory space. This issue seems to happen with 1 client connected, or 20, it doesn't really seem to matter.
This causes other issues, like a customer who thinks he is disconnected, will shut down his app, which is supposed to send a command to close the connection on the server side which it does not., so now I have several "closed" connections still open on the server, which is obviously also bad. Another thing I dont get is that it worked fine when I was developing the pieces on my dev box, so I dont get why I have all of these "timeout" issues now. (I put that in quotes, because the timeout period is the default of 10 mins, and I xmit data, at LEAST every minute when the server pushes data updates to all clients)
Here is some of the relevant code
vb
'Command Object, this holds all of the command information being passed back and forth to tell the server what to do, and as well as hold the response.
'The strCMD is the command, strParms is the parameters of the command, obj is ANY object I want to send along with this information
<Serializable()> Public Structure CommandData
Public strCMD As String
[Code] .....
View 7 Replies
May 13, 2010
How to increase speed of receiving data through GPRS? We connect through UDP Protocol and sync method for receiving DATA. Can you suggest me to best way to communicate with GPRS? [Code]
View 3 Replies
Jun 11, 2011
Does anyone knows how to program using vb.net with rs232 module?, all i know is that i should use a compolet, but i can't understand a thing regarding the sending and receiving bit data to the machine..
View 1 Replies
Aug 13, 2009
I'm trying to control a serial port device that both send and receives data. I can receive data quite happily from the serial port but I don't appear to be able to send data to the device. The device works perfectly as I can test it using putty, I open putty select serial and select 1200 baud, the device immediately lights up and can send and receive. However when the port is set up and opened in VB the device doesn't light up so I can't send data to it but can receive data from it. According to the instructions I need to send either ASCII 'X' Hex '$58' or Decimal '88' to make the device ready.
Code (VB Studio 2005) :-
Public Sub New(ByVal synchronisingObject As ISynchronizeInvoke)
ComPortUsed = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESoftwareNJB", "COMUSED", Nothing)
PricePerTrack = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINESoftwareNJB", "PRICETRACK", Nothing)
Me.synchronisingObject = synchronisingObject
[Code] .....
View 11 Replies
Sep 14, 2009
I am developing an application which is pretty much a replacement of a hyperterminal. I am trying to send commands to the serial port using MSComm in VB6.0 When I type in on the hyperterminal h003128 I get a response OK. Or when I type in i003 it displays back some values.
What I am trying to figure out how do I send the h003128 via VB6. I believe I've undertood how to send data to the port. It seems I am not getting the correct formate. This wont work.. the formate iAAADDD where i = i AAA = 003 and DDD = 128 MSComm1.Output "i003128"
View 3 Replies
Feb 22, 2011
Opening and closing the port works fine, and as far as i can tell, the serial.write("blahblah") should be writing to the output buffer, but I am unable to test or verify this by reading it in. the commented "Receive data from serial port" and subsequent DoUpdate() function are where i am having trouble. It doesnt seem to actually be reading in the data if it is in fact writing it correctly.
[Code]...
View 9 Replies
Aug 16, 2010
I have a very basic knowledge of coding, just enough to understand some PicBASIC Pro and program a microchip to send the values of some variables to a PC via the com port. I've used a terminal utility like Hyperterm to confirm the right variables are being sent, so I thought it would be cool to have a custom application on the PC to display these variables, and possible set them via the application by writing the new one back to the PIC. So I downloaded VB express 2008 - and whilst it was "simple" to draw a box and add a few text boxes I'm lost at how to actually do anything practical with it
[Code]...
Could someone advise me in laymens terms exactly what I need to do inorder to populate the text boxes with the data from the PIC micro. Whilst I understand the basics about BASIC, I have no idea on things like classes etc
View 5 Replies
Dec 20, 2009
What I am doing is creating an app to send and receive CNC programs to machine tools via the RS232 interface. At the moment I am testing the software with 2 laptops linked together through a cable I have made up. which all works. I have added a serial port to my form 1 and using the code below I can send and receive data. However with the send button I can open the comm port send the data and then close the comm port (No Problems there). With the receive button I want to open the comm port receive the data and close the comm port. The problem I have is checking when the app has finished receiving data so I can then close the comm port
Private Sub Btn_Send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Send.Click
Try
[Code]....
View 2 Replies