473,386 Members | 1,815 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,386 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 1497
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.