Click here to Skip to main content
15,887,812 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to programmatically trigger an event? Pin
Anonymous4-Dec-02 7:21
Anonymous4-Dec-02 7:21 
GeneralDesign Patterns Pin
John Rayner3-Dec-02 7:40
John Rayner3-Dec-02 7:40 
GeneralRe: Design Patterns Pin
Chris Austin3-Dec-02 10:03
Chris Austin3-Dec-02 10:03 
GeneralRe: Design Patterns Pin
Jarrod Marshall4-Dec-02 7:42
Jarrod Marshall4-Dec-02 7:42 
GeneralUnicode Characters Pin
Jassim Rahma3-Dec-02 6:25
Jassim Rahma3-Dec-02 6:25 
GeneralRe: Unicode Characters Pin
Nick Parker3-Dec-02 8:08
protectorNick Parker3-Dec-02 8:08 
GeneralRemoting: Inter object communication. Pin
Nathan Tran3-Dec-02 6:07
Nathan Tran3-Dec-02 6:07 
GeneralRe: Remoting: Inter object communication. Pin
John Rayner3-Dec-02 8:04
John Rayner3-Dec-02 8:04 
Well, if I understand you correctly you are trying to get your chat server to send a message to the chat client. This message would probably be a new posting to the current discussion. Not having done this before, I'm probably a little out of my depth but here goes anyway ...

Firewalls are obviously going to limit a direct TCP / UDP connection from the server to the client so that option is out. That means that all communication has to be initiated by the chat client. So two options spring to mind:
  1. Have the client poll the server every so often - you don't really get instant chat here and the closer you get to it (i.e. by polling more frequently) the more it clogs up your network and your server.

  2. Have the client initiate an asynchronous request to the server which blocks until the server services it. Then, when a new message comes in to the server it hands the message off to the client. The client sees the response come back and immediately opens another async request.

    You'll need a reliable way of identifying individual clients - if you're concerned about firewalls then I don't think IP address will be good enough. Probably each client would need to get an ID from the server and send that along with every request made.


I'd say the second is preferable from a network traffic and immediacy point of view, but it probably won't scale with the number of users (e.g. 5000 users = 5000 connections at the server waiting to be filled). But then who'd want to be in a discussion with 5000 people?!? It will also make the server quite complex to implement as it will have to keep track of which messages have been passed out to which clients. Also, if you have a very active discussion, the client may struggle to keep up - this could be avoided by each client having a number of outstanding requests to the server, but that would further limit the scalability.

Anybody else have any other ideas?
GeneralRe: Remoting: Inter object communication. Pin
Nathan Tran3-Dec-02 10:41
Nathan Tran3-Dec-02 10:41 
GeneralRe: Remoting: Inter object communication. Pin
John Rayner4-Dec-02 0:33
John Rayner4-Dec-02 0:33 
GeneralRe: Remoting: Inter object communication. Pin
Nathan Tran4-Dec-02 6:59
Nathan Tran4-Dec-02 6:59 
GeneralRe: Remoting: Inter object communication. Pin
John Rayner4-Dec-02 7:17
John Rayner4-Dec-02 7:17 
GeneralMonthCalendar Pin
rurko753-Dec-02 5:38
sussrurko753-Dec-02 5:38 
GeneralRe: MonthCalendar Pin
kaschimer3-Dec-02 10:46
kaschimer3-Dec-02 10:46 
GeneralWindows Messages Pin
Sean Rock3-Dec-02 3:34
Sean Rock3-Dec-02 3:34 
GeneralRe: Windows Messages Pin
Jeff J3-Dec-02 15:28
Jeff J3-Dec-02 15:28 
GeneralRe: Windows Messages Pin
Sean Rock3-Dec-02 22:08
Sean Rock3-Dec-02 22:08 
GeneralConverting Texbox.Text to int 32 Pin
djkno33-Dec-02 1:28
djkno33-Dec-02 1:28 
GeneralRe: Converting Texbox.Text to int 32 Pin
Rickard Andersson203-Dec-02 1:47
Rickard Andersson203-Dec-02 1:47 
GeneralRe: Converting Texbox.Text to int 32 Pin
djkno33-Dec-02 3:09
djkno33-Dec-02 3:09 
GeneralRe: Converting Texbox.Text to int 32 Pin
kaschimer3-Dec-02 4:01
kaschimer3-Dec-02 4:01 
GeneralRe: Converting Texbox.Text to int 32 Pin
djkno33-Dec-02 4:50
djkno33-Dec-02 4:50 
GeneralRe: Converting Texbox.Text to int 32 Pin
Pyt3-Dec-02 1:47
Pyt3-Dec-02 1:47 
GeneralRe: Converting Texbox.Text to int 32 Pin
djkno33-Dec-02 3:12
djkno33-Dec-02 3:12 
Generalclass diagram Pin
Anonymous3-Dec-02 0:54
Anonymous3-Dec-02 0:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.