PC Review


Reply
Thread Tools Rate Thread

design for socket server and client as a service

 
 
Jonathan
Guest
Posts: n/a
 
      3rd Dec 2009
Hello everyone,

I could really do with your help with some design decisions on this;
none of my peers has C# experience and I lurch from frustration to
Eureka moments learning it alone!

I won't ramble on in order to keep this concise

scenario:
====================
I am developing a windows service to accept incoming messages from one
server, transform them and send to another server via sockets.

Biztalk et al are not an option for me.

I have a number of constraints that i need to work around:
o The destination server is available on a schedule so i need to take
care of downtime
o the destination server is liable to be taken down on an ad-hoc basis
so disconnects and reconnects need to be handled
o The source server makes a connection and maintains this indefinitely
for subsequent messages as long as there is activity...
o the source server will only maintain its connection for a limited time
idle (several hours but not indefinitely)
o the source server requires acknowledgement (ACK/NACK) of acceptance of
a message before sending subsequent messages
o the destination server provides no acknowledgement of message receipt

In analysing the requirements I have come up with the following
candidate objects:

Service controller (instantiated by the ServiceBase subclass)
==============================================================
Start()
Stop()
methods which set an instance variable to indicate whether the service
should stop

A method which is invoked on a thread to contain all logic for message
handling.


ClientSocket class
=========================
contains plumbing code for client socket and methods to send outgoing
messages
method to determine whether the client is available...


ServerSocket class
========================
contains plumbing code for server socket and methods to acquire incoming
messages


This isn't complete but captures the essence, I feel.

I am, however, struggling with the logic to manage this; particularly
the exceptional conditions which may occur within the main thread loop...
For instance, either end of the connection may drop at any point, the
client end may or may not be available and I need to wait until it is, I
may need to reset and reconnect either end should they be down, and all
within the confines of the while-loop which continues as long as the
service is up.

I just can't help thinking that I am missing some part of the puzzle -
maybe I am not constrained to do everything in the same threaded method
and I could implement a Timer callback outside the thread with no
consequential effects.


Is anyone able to suggest the skeleton of a robust design or point me at
a suitable resource?
I am conscious that this has turned into something less than concise
but, not knowing the answers makes it difficult to ask the right questions.

Here's hoping you you might provide me with another Eureka moment.

Regards
Jon
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Client Socket Shutdown is not visible on the Server Socket Miroslav Endys Microsoft Dot NET Framework 1 5th Nov 2007 04:52 PM
Client Socket Shutdown is not visible on the Server Socket Miroslav Endys Microsoft Dot NET 1 5th Nov 2007 04:52 PM
Sync. socket client and server example Ole Microsoft Dot NET Compact Framework 7 17th May 2006 05:07 PM
PDA socket client-server question =?Utf-8?B?Sm9u?= Microsoft Dot NET Compact Framework 0 26th Jan 2006 07:53 PM
Socket Server to Socket Client..Client function not working when called from Server... trint Microsoft C# .NET 2 13th Apr 2005 09:43 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:44 PM.