Identify Connection Lost Between Socket Server And Socket Client?

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


ADVERTISEMENT

.net - Check The Connection State Of A TCP Server (Socket) With TCP Client?

Apr 23, 2012

For almost a week I am reading and trying to find a solution for checking connection state using a TCP Client (using socket class) In my scenario I have a TCP Client that is connected to a server (it is not controlled by me) and i want that from time to time to check the connection state, and reconnect if necessary.I have read a lot of information on the internet but i did not find a suitable solution.Briefly, these are the methods that i have found on the internet and try to implement.But unfortunatelly, i have found some scenarios where the TCP Server is closed and the TCP Client is still saying Connected 1.Example from MSDN

[code]...

View 1 Replies

Get The Client Connection Parameters Of The Socket On Server Side?

Sep 13, 2011

I want both the client and server to write and read resp. at a constant rate (which can be configured on the GUI of the client) to the buffer.I am able to send from the client at 150 bytes per packet Now, I should be able to read also at 150 bytes per packet on the server too Since, both are connected through a socket, can we retrieve the socket params (set on the client size, like 150 here) from the server end, using the tcpServer object.Or is it must to send an initial setup packet which tells about these client params and so accordingly the server can continue?

View 1 Replies

Client Socket - Send Message Through Client Socket Receive Specified Argument Was Out Of Range Of Valid Values

Oct 15, 2011

Below is my code, but when i send the message thru client socket i receive Specified argument was out of the range of valid values. Parameter name: size

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim serverStream As NetworkStream = clientSocket.GetStream()
Dim outStream As Byte() = _
System.Text.Encoding.ASCII.GetBytes("0800822000000000000004000000000000000920092126012345001")

[CODE]...

View 1 Replies

Managing Multiple Client Socket Connection?

Sep 11, 2011

Am developing a server - client application using the system.net class , that will have more than 5000 simultenous client connection.what is the best way to manage multiple client connection like this?

View 3 Replies

Client Server Winsock Or Socket Programming?

Jul 14, 2009

how to access client side activity i.e. which client is connected and which computer connected at the same time from server.

View 1 Replies

Info: Multithreaded Server Socket Program Or Client/Server?

Oct 26, 2011

I made a simple TCP server (I've found the example on the web) in VB to receive data from about 40 TCP clients.The clients are not synchronized but sends data about every 18 minutes; the problem is sometimes several clients sends data at the same moment, so I can't receive data.I also made a second program that reads the data (server program writes data on a file, read from the second program) scheduled.

My question is this: I've seen on the web examples about Multithreaded Server Socket Program, so I suppose this could manage my 40 clients (but now the clients are syncronized and send data at the same time in client mode) or is better get data (I have a central client that asks data to all 40 devices in server mode)?

Second question: can I make a single program where I run both TCP client and TCP server at the same time?

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

Specific Cast Is Not Valid In Client Server Socket Program

Jun 14, 2012

I am Working on Teghax Component.Using This Component we want to find out Block title attribute of dwg file in a client server socket application.

1> We get Block title attributes properly of dwg file in windows application form using the getattribute function().

2> We get Block title Attributes properly in that way:-We take a class library where we take a class.in this class we use getattribute function().Then We access the particular class from another project

But when we use the same class(Keep same structure) in client server socket program.Then it gives an exception.i.e ,"Spaicfied cast is not valid"I am Not getting any reply form teghax developer..I attached exception screen sort.Give me Suggestion How to solve this Exception

Code given Bellow :

Public Function Get_DwgFileAttribute(ByVal Sender As ClsTcpConnection, ByVal msgTag As Byte, ByVal message As String) As String
Dictionary = GetHashtable(message)
Dim varfilepath As String = CStr(Dictionary.Item("filePath"))

[code]....

View 1 Replies

VS 2010 TCP Chat Server Closes Socket On Client DisConnect?

Jun 24, 2010

I am working on a chat client and server, and so far it works well, but when I close the client, the server throws an exception because it continues to try to do processes on the disconnected client. I have tried adding clientSocket.Close() in various places throughout the client and server with no luck. Does someone know how to add the disconnect code to either the server or client with this code?Server:

Imports System.Net.Sockets
Imports System.Text
Module Module1

[code].....

View 5 Replies

Socket Programming - Close A Connection From Server?

Nov 24, 2011

I have the following code in my Server Form:

Imports System.Net, System.Net.Sockets
Public Class ServerForm
Private serverSocket As Socket
Private clientSocket As Socket

[code]....

for the first time, when I click on Connect, it is going to connect to server as well and also it works if you click on the disconnect. for the second time if you click on the Connect button, it gets connected but the disconnect button is not working.

View 9 Replies

Asynchronous Socket Programming Vb 2008(.net) Again Server Should Able To Send The Data To Client

Feb 2, 2011

I am facing problem in asynchronous socket communication.

1)I wanted to perform connect(from client to server) operation on enter button and send the data whatever client want to send and disconnect from server. And again client should get connect to server whenever client wanted to send data. this is the mechanism.

i.e how to reuse the socket.

2)Again Server should able to send the data to client.

View 5 Replies

Communicate From Client To Server From Multiple Clients On Multiple Requests In Socket Programming?

Jan 8, 2010

I have been struggling to find a solution for this problem. What I need to do is build a server application that accepts tcp client requests from different clients running on same port say:1003. I experimented by using asynchronous mode call backs etc. but it disconnects once connection is established and does not respond for further requests from the same client.

View 1 Replies

How To Check If Client Socket Has Disconnected

Apr 13, 2009

i am using the client/server classes for file transfer by moeur.what i want to know is that once my client is connected to the server and after that the client machine goes off the network. now when my server trys to send a file or some message to the client i am not able to trap the error that the client is disconnected.how to do this. there might be a case where the client machine suddenly shuts down. in such cases how will my server know that the client has disconnected.

View 2 Replies

VS 2005 StackOverflowException In Socket Client?

Apr 6, 2010

I'm working on a simple socket client application that transfers files from one PC to another. The flow is as follows.

Client sends message to Server
Client Listens for response
Server responds with command
Client sends file or message to Server
Client Listens for response

This sequence will repeat thousands if not tens of thousands of times. It runs great on my dev box but when I load it on another machine I get a StackOverFlowException. I know why I'm getting the stack overflow. It's because I have a Listen subroutine that calls a Send routine. When the Send routine is done it calls the Listen routine again. The process works for about 614 iterations and then bombs out with a stack overflow. I guess my question is, how can I code a socket application that can send-->listen-->send-->listen thousands of times without blowing the stack?

View 1 Replies

C# - Set Up A Web Socket Connection In .NET

Jun 22, 2011

I have my index.aspx file:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="index.aspx.vb" Inherits="Web_Socket.index" %>
<!DOCTYPE html>
<html>

[Code]....

so now my question is how do i connect the WebSocketServer.cs to the index.aspx ?

As a start, all I'm trying to accomplish is just to get the Web Sockets working, and have the connection established, which then will alert("Stock Ticker Connection open ...");

View 1 Replies

Implement TCP KeepAlive In Program On A TCP Client(socket)?

Apr 24, 2012

I want to implement the TCP KeepAlive in order to check dropped connections by running a timer.

In my case, I have a TCP Client (using socket class) and a third party server (i have no control on it).

How can i use the TCP KeepAlive on my TCP Client in order to check the connection state?[code]...

View 1 Replies

Threading Windows Service TCP Socket Client?

Jan 22, 2012

I'm trying to build a multithreaded SMPP client with VS2008 and I'm getting bogged down in threading. Basically my main parent thread will interact with the windows service scheduler, get registry settings, and get a list of SMPP servers to connect to. Then it will launch a thread for each SMPP connection, which will need to keep it's TCP socket open to receive messages with, so the thread must remain running even if there aren't any events happening (no messages to receive)... but I can't seem to get it figured out.

[Code]...

The Start sub in the oChannel object does run, but once that sub is finished running the thread ends. In the Start sub, it calls other code that initiates a connection to the remote SMPP server, but that code asynchronously waits for an event to be raised regarding the connection status. Once the sub finishes, the async connection being attempted doesn't seem to be able to pin the thread down.

View 3 Replies

C# - Connection In Win7 Using Socket Programming

Jan 2, 2012

I am using socket programming in vb.net to create a server client remoting application. The problem occurs when I use both the client and server in a win 7 box. It works fine for win xp or cross-platform communication (e.g. win xp to win 7). Below are the codes used at the client and server end:

[Code]...

View 2 Replies

Communications :: Socket Connection Error

Aug 1, 2008

I'm working on an application that communicates to torque controllers on the factor floor. The user inputs an IP address and a port and clicks the btnConnect button to make the initial connection. Once that completes a KeepAlive message must be sent periodically to maintain communication with the torque controller. The initial connection works very well but a socket error (see below) grinds everything to a halt when the KeepAlive message is sent. I would appreiciate any ideas the readers may have on the root cause. I'm quite confused because basically the same code is use for both the initial connection and then the KeepAlive messages. I have pasted some of the code as well below.

[code]...

View 1 Replies

Socket Connection - Calling WriteData Sub

Nov 22, 2010

I am trying to make a class that will allow me to open a socket, leave it open and then write to it when needed. I wrote the following code but whenever I call the writeData sub I get an error with the network stream. Its says it is not an open connection. I call the connection sub first and then the writeData sub.

Imports System.Net.Sockets
Imports
System.Text
Public
Class vizSocketConnect
[Code] .....

View 4 Replies

.net - Socket.AsyncSend Behavior When Remote Client Stops Receiving

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

Converting Socket Connection From Python To VB 2010?

Mar 23, 2012

I have codes which is written with python. I am not good with python and i want to convert this python codes to VB 2010.This python function searching local network and finding my LG TV's local IP adress. I want to find my TV's local IP with VB 2010.

[Code]...

View 9 Replies

Receive Data From Multicast LAN IP With Socket Connection?

Mar 24, 2012

I converted some codes from python to VB 2010. My aim is sending query data to multicast IP and get the response. My query data receiving from device which is connected to my LAN. Also the device responding my query and my PC receiving the responce but at this point the VB program freezing.getting response data and printing to console without freezing.

This is the code list;

Imports System.Net
Imports System.Net.Sockets
Imports System.Text

[code]....

Here is the Wire Shark (Network Protocol Anlyzer) screen shots; My computer IP is : 192.168.0.11 and device's IP is : 192.168.0.10.

View 2 Replies

Use The Code From Microsoft For An Async Socket Connection?

Mar 26, 2010

I am trying to use the code from Microsoft for an Async Socket connection. It appears the listener runs in the main thread locking the GUI. I am new at both socket connections and multi-threading all at the same time. Having a hard time getting my mind wrapped around this all at once.

[Co0de]...

View 1 Replies

VS 2008 Socket Connection For Realtime Data?

Feb 28, 2011

i need a little advice/help here. There is a particular scenario that is coming up and I am clueless as to how to go about it."I will soon have a lease line through which I will get realtime stock market data. This data will be available every second and it will contain prices of stocks. Now assume I am able to get that data on my local computer. How can I transmit data so that users can get that data through my software.

For e.g. assume it's 11 AM. Now if you select a stock e.g. Google, then my program should fetch data for google till 11 AM and also show new data every second or so with minimum lag. Something like a terminal where you see stock prices getting updates every second. In my case I need to get past data and show current data which get updated at short intervals."

Now I have a linux vps webserver which hosts my site. (I get one or two static ip free) What to do so that data goes from my local computer to my server and then my program (developed in vb.net) is able to get it and show it to end user. This whole system should such that its fast (real-time) and delay is minimum.

View 6 Replies

VS 2008 System.Net.Socket Connection Status?

Dec 8, 2009

im trying to detect if the connection is still active upon trying to send or receive anything. Now I have checks in place if it's connected then it will send or receive however... it's saying it's connected when it is not connected... and therefore my program tries to send and receive and errors.

I am determining if it is ok to send and receive by using the Socket.Poll(-1, SelectMode.SelectWrite)

if it's true then im connected and data can be passed..This seems to always be true until I send something and it fails..How can I catch the socket not being connected before it fails upon sending or receiving?

View 6 Replies

Communications :: Use A Socket Connection On Vb To Communicate With PC Without Using GSM Modem And SIM Card?

Apr 1, 2009

I would like to know can we use a socket connection on vb to communicate with PC without using GSM modem and SIM card.for example, like sendin a simple text msg to the PC and it will reply back the result back to me the result.

View 1 Replies

Communications :: Socket Behaviour - Created A Client That Can Send And Receive Data Via TCP Sockets

Aug 26, 2010

I have created a Client that can send and receive data via TCP sockets. The objects stored on the serverside are the *exact* same object used for the client. They use the same send and receive protocols.

Now, when i send a string from the server to the client , it does precisely what it should do. However when I send a string to the server.... I do receive the string as an equal length of NULL characters. I run the server and client locally.

Basicly what can influence the behaviour between two completely identical objects performing the exact same task? I wonder if there is some socketflag issue if the TCPlistener.accept function returns a completely different setup then the one I R used to.

(if it is of any interest, the send protocol is asynchronious)

View 3 Replies

Chat (Using Socket) Server In Web Hosting?

Nov 29, 2011

Read this: [URL]. Now the question: I want the client will connect to web server (or web hosting).

View 8 Replies







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