473,237 Members | 1,184 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

Help needed: TCP Server questions/problems

(About me: I know very little about writing server applications. I
have done plenty of VB6 desktop app work but this is my first server
program. I got it to work by modifying examples. I understand what
it is doing but not much about what is involved in extending it. )

I am not necessarily looking for code examples here, just some
pointers as to what direction I need to proceed to resolve these
things.

I have written a multithreaded TCP/IP server. This program's job is
to listen to requests from a Java program running on some wireless
phones. On the server side it interacts with SQL Server 2000. It
accepts connections, is passed login credentials, recieves some data
update from the client and sends back some results. The program
itself works fine. I am now trying to improve upon it and have run
into the following issues/problems:

1. I want this to run as a Windows service a la SMTP. When it runs as
an interactive program it consumes 5-8% of the CPU time. When it runs
as a service it consumes all it can get. When it runs it is ALWAYS
the top CPU user on the machine. I like to think that when clients
aren't connected it shouldn't be using 90% of the CPU time.

2. I would like to be able to monitor what it is doing. When I ran
it as a console app I could write out messages to the console telling
me how many clients were connected and what they were sending or being
sent. I would like to wite a monitor program that can tap into the
service that can receive the equivalent messages to be displayed in a
text window since services don't get to talk to the console. My first
thoughts would be to try to treat it like a COM object and raise
events but I don't know if that model works in VB.Net or with services
in general.

3. I would like to be able to log each clients' conversation to a
text file for review. I created a logfile class with open,write and
close methods that creates/opens a log file. This works fine in the
console app but the service app seems unable to do this. Do services
have the ability to write to the filesystem?

TIA
Nov 20 '05 #1
5 1487
Have a look at remoting for the monitoring of you app. For the file system
question, make the service run under a user name, and allow that user to
have permissions on the file system.

GW

"Matthew Speed" <ms****@mspeed.net> wrote in message
news:ai********************************@4ax.com...
(About me: I know very little about writing server applications. I
have done plenty of VB6 desktop app work but this is my first server
program. I got it to work by modifying examples. I understand what
it is doing but not much about what is involved in extending it. )

I am not necessarily looking for code examples here, just some
pointers as to what direction I need to proceed to resolve these
things.

I have written a multithreaded TCP/IP server. This program's job is
to listen to requests from a Java program running on some wireless
phones. On the server side it interacts with SQL Server 2000. It
accepts connections, is passed login credentials, recieves some data
update from the client and sends back some results. The program
itself works fine. I am now trying to improve upon it and have run
into the following issues/problems:

1. I want this to run as a Windows service a la SMTP. When it runs as
an interactive program it consumes 5-8% of the CPU time. When it runs
as a service it consumes all it can get. When it runs it is ALWAYS
the top CPU user on the machine. I like to think that when clients
aren't connected it shouldn't be using 90% of the CPU time.

2. I would like to be able to monitor what it is doing. When I ran
it as a console app I could write out messages to the console telling
me how many clients were connected and what they were sending or being
sent. I would like to wite a monitor program that can tap into the
service that can receive the equivalent messages to be displayed in a
text window since services don't get to talk to the console. My first
thoughts would be to try to treat it like a COM object and raise
events but I don't know if that model works in VB.Net or with services
in general.

3. I would like to be able to log each clients' conversation to a
text file for review. I created a logfile class with open,write and
close methods that creates/opens a log file. This works fine in the
console app but the service app seems unable to do this. Do services
have the ability to write to the filesystem?

TIA

Nov 20 '05 #2
Hi Matthew,

Thanks for posting in the community.

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.
Thanks!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 20 '05 #3
Hi Matthew,

Thanks for posting in the community.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to create a TCP/IP
server as an windows service.
Also you wants to monitor the service with an UI application(winform app)
and write to file. And you find the application will exaust all the CPU
when there is no active connection.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I agree with Glenn's suggestion that utilized the remoting the do the IPC
between the windows service and the monitor APP. You can also handle the
remoting object's event to achieve your aim.

How To: Host a Remote Object in a Windows Service
http://msdn.microsoft.com/library/de...us/dnnetsec/ht
ml/SecNetHT15.asp

Windows Service can access the file system, but you need to check if the
account you use the run the service has the permission to access to the log
file you want to write to.

As for the first question, I suggest you may check if there is any
difference between the code between console application and the windows
services. Usually a standard Server Socket application will suspend at a
line similar with below to wait for conncetion from client.
' Program is suspended while waiting for an incoming
connection.
Dim handler As Socket = listener.Accept()
Since your application is high CPU consumer when there is no client
connection, so you may try to debug into the windows service to see which
code line cause the high CPU time consumption.

To debug an windows service, you may need to attach vs.net debugger to a
running windows service

Debugging Windows Service Applications
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbtskdebuggingserviceapplications.asp

If you will accept multiple connections at one time in the services, I
think the Asynchronous invoking will be good pratices.

Asynchronous Server Socket Example
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconnon-blockingserversocketexample.asp

Asynchronous Client Socket Example
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconnon-blockingclientsocketexample.asp

If you have any concern on this issue, please post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4
Hi Matthew,

Thanks for posting in the community.

If you have any concern on this issue, please feel free to post here and I
will work on it with you.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #5
On Mon, 16 Feb 2004 07:06:30 GMT, v-******@online.microsoft.com (Peter
Huang) wrote:

Thank you for your response. I will look into each of these over the
next few days and add to my application to determine whether or not
those do what I am looking for.
Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: andy | last post by:
Hi, I'm trying to get mod_python working on my web server, but I'm running into problems, possibly due to having virtual hosts configured. I'm no apache guru (newbie is more accurate!) so I...
8
by: slim | last post by:
hi again all, i am still working on the website as mentioned in earlier threads and have hit another snag... http://awash.demon.co.uk/index.php http://awash.demon.co.uk/vd.css the php is...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
27
by: VK | last post by:
<http://www.jibbering.com/faq/#FAQ3_2> The parts where update, replacement or add-on is needed are in <update> tag. 3.2 What online resources are available? Javascript FAQ sites, please...
0
by: Rob Cheshire | last post by:
Hi to all, I need some help deciding on the best database system for our specific application. OPTIONAL INFO: We currently have 2 separate projects that need to be updated from dos-based dBase. ...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
13
by: Siegfried Heintze | last post by:
I refered the engineer at my hosting service to http://support.microsoft.com/default.aspx?scid=kb;en-us;825738 where he tried to follow the directions there. He said there was no such file:...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.