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


ADVERTISEMENT

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

Windows Service Running Socket Server On Specified Port (Secured)

Jun 30, 2010

I wanted to know what are the risks of opening up a socket server on a specified port? Right now I have it limited to only accept requests from 1 specific IP to that port and all the other ones get rejected (using the windows firewall), is there a way to implement an authentication or anything else so I can allow it to be accessed from any IP worldwide yet have it secured?

View 1 Replies

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

Install A .NET Windows Service - This Is Not Available In The Client's System?

Feb 8, 2006

I have written a VB.NET windows service application. I installed it in my system using the Installutil.exe. But this is not available in the client's system because the .NET is not installed in that system.Is there any way to install the .NET windows service application without the Installutil ?

View 4 Replies

Make A LAN IM Client Using The Net Send Command - Intercept Messages From Windows Messenger Service

Jun 5, 2009

I'm trying to make a LAN IM client using the net send command and I was wondering if there is any way to capture the text of the messages received through net send and display them in a label.

View 6 Replies

Threading And Socket Connections Approach

Jul 2, 2011

Im writing a small application that need to make up to 300 socket connections at the same time. However i'm pretty confused on how to approach this. My first theory is to have my main thread to manually fire up 300 new threads that each handle all that needs to be done. Another theory is to fire up lets say 10 threads that makes 30 async connections. My last theory is to have my mainthread work with all 300 async connections together with everything else. The question to this is what would be the most effective way to go to save resources and maintain speed.

View 1 Replies

Web Service Client Accessing Java Web Service / Connection Aborted

Sep 27, 2010

I had a problem getting a VB.NET web service client to receive the response object from a Java web service.In the process of posting this question someone from another department volunteered some code written for a similar situation.I couldn't find this anywhere on the net so I'm completing my question to help others out.[code]The web service is Apache CXF with some Spring elements mixed in.

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

.net - WCF Service Hosted In A Managed Windows Service Connect Using A WCF Service Application

Jul 14, 2011

i have a Windows service that is hosting a WCF service through net.tcp and this is working great. I have also created a WCF service application. I am trying to add the net.tcp service reference to the service application. Then I add it to the GAC that goes ok but if I try to RegAsm the WCF service application to allow it to be called from Server.CreateObject I get the error:

Warning: Type library exporter encountered a type that derives from a
generic class and is not marked as
[ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be
exposed for such types. Consider marking the type with
[ClassInterface(ClassInterfaceType.None)] and exposing an explicit
interface as the default interface to COM using the
ComDefaultInterface attribute.

It does not work. I have tried to call it through a class library but this does not work either as the end point is not set correctly.

View 1 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

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

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

VS 2008 TCP Client/Server Threading?

Nov 11, 2009

Is is possible for the server to give all clients that are connected to it a separate threading starting from 1-2-3-etc that will be display there username on a listview. Server can now connect to any of them by clicking on one of the items in the listview.

EX: Multi-Clients Connect to server ---> Server gives each one a separate thread starting with 1 ----> Client sends username to server -----> Server displays them on listview ---> Server can now double click or whatever on the item ---> Pulles up thread count and connects to it.

View 1 Replies

.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

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

Multi Threading SQL Client Write Queries?

Dec 14, 2011

I have a MS sql database (not server), my program reads file structure from my 2 TB external drive and saves the list a records in database. I write around 80k records every time and it takes a great time.I am currently writing records by dividing them into 2 background Worker thread 40k each. My pc is Quad core Phenom II.What is the best way to achieve this and also would there be any benefits by increasing the number of threads because mine is only a 7200rpm hdd and not raid. What I mean is HDD might be a limitation?

View 2 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

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

Use Multi-threading Or Delegates In A Service ?

Nov 6, 2008

Whether i should use multi-threading or delegates in a service that i am writing. I have written a couple of services before (with multi-threading) but think that i could have done a better job of it. The service does not have a UI, it only needs to interact with a database and around 800 ip addresses. I just need advice on which way would be better in terms of efficiency, if for example i needed to send data to all 800 ip addresses at once.

View 2 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

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

[VS 2005] Service Control Manager Privileges - Communicate With A Windows Service On A Remote Machine On The Network

Jul 23, 2009

I am trying to communicate with a Windows service on a remote machine on the network but i keep getting an exception saying the following: "System.InvalidOperationException: Cannot open Service Control Manager on computer 'machine001'. This operation might require other priviledges. ---> System.ComponentModel.Win32Exception: Access is denied.

[Code]...

View 4 Replies

Have A Dotnet Windows Service Which Monitor Other Services And Upon Stop Of Any Service?

Sep 18, 2009

Is it possible to have a dotnet windows service which monitor other services and upon stop of any service, the monitoring service would be able to start the stopped service.

View 4 Replies

Use Windows Search Service Instead Of The Old Indexing Service To Index Files?

Jul 7, 2009

In the past I had the indexing service installed on a Windows Server 2003 and used it to index files for my website. I did this by executing an OleDbCommand with a query and a connection string.How do I accomplish the same thing with the new "Windows Search Service" (Windows Server 2008) by using VB.NET? Does this work the same way so that I only need to change the Provider name which has been "MSIDXS.1" up to now? Case true, what is the new Provider name?

View 1 Replies

Windows Service: Multiple Instances Of The Same Service Class?

May 3, 2011

When you create a Windows Service, you create a list of the services you want to start. The default is this:

ServicesToRun = New System.ServiceProcess.ServiceBase() {New Service}

Can you have multiple instances of the same Service class (that bind to different addresses or ports), like this?

ServicesToRun = New System.ServiceProcess.ServiceBase() {New Service("Option1"), New Service("Option2")}

Or will that cause problems? Should we use two different classes instead?

View 1 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







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