Click here to Skip to main content
15,893,564 members
Home / Discussions / C#
   

C#

 
AnswerRe: ASP.NET and C#.NET - create a open file dialog box Pin
rajandeepak27-Feb-06 15:37
rajandeepak27-Feb-06 15:37 
GeneralRe: ASP.NET and C#.NET - create a open file dialog box Pin
deepak127-Feb-06 17:29
deepak127-Feb-06 17:29 
Questionhow to burn a cd with C# ? Pin
f_o_x27-Feb-06 12:37
f_o_x27-Feb-06 12:37 
AnswerRe: how to burn a cd with C# ? Pin
Expert Coming27-Feb-06 12:54
Expert Coming27-Feb-06 12:54 
QuestionOpen Directory Dialog Pin
Monin D.27-Feb-06 10:15
Monin D.27-Feb-06 10:15 
AnswerRe: Open Directory Dialog Pin
mikker_12327-Feb-06 10:24
mikker_12327-Feb-06 10:24 
GeneralRe: Open Directory Dialog Pin
tray_gator27-Feb-06 11:09
tray_gator27-Feb-06 11:09 
QuestionKeeping track of users within a server Pin
paranoiduk27-Feb-06 10:08
paranoiduk27-Feb-06 10:08 
Hi all, I've got a problem...

I'm using the wodBeep controls (http://www.softplatz.com/Soft/Development/Other/wodBeep.html) to try and create a client/server application.

The server must maintain a list of the users and as a client sends information to the server, the server should then relay it to the correct subset of users.

The problem is, I can't find a good way of figuring out how to store this information.

At the moment when a client connects it sends a serialized userobject, containing some basic information that is common accross both the server and the client... but I have no idea how to work out which instance of the beep object this should be related to. Below is the relevent code from my project.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using affinityBeepProfiles;
//using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using WODBEEPCOMLib;
using affinitySharedClasses;
using System.IO;
using System.Xml.Serialization;
using System.Collections;

namespace affinityServer
{

public partial class frmMain : Form
{

private wodBeepCom myBeep;
private affinityBeepProfile myBeepProfile;
private BeepTransportTCP myBeepTCP;
private user myUser;
private int beepCount = 0;
private Hashtable myUsers = new Hashtable();
public frmMain()
{
InitializeComponent();

}
private void myBeep_Disconnected(int errorCode, string errorText)
{
txtStatus.Text += "[Client disconnected]";
if (errorCode > 0)
{
txtStatus.Text += " - " + errorText;
}
txtStatus.Text += "\r\n";
}
private void myBeep_Connected(object PeerInfo)
{
txtStatus.Text += "[Client connected]\r\n";
//add this current beep interface onto myUsers
myUsers.Add(beepCount, myBeep);
BeepMessage beepMessage = new BeepMessage();
beepMessage.Body = "BIN\r\n" + beepCount;
beepMessage.Type = MessageTypes.msgOther;
myBeep.Transport.Send(beepMessage, 0);
//create new beep instance
createNewBeep();
txtStatus.Text += "{new BEEP instance created}\r\n";
}
private void frmMain_Load(object sender, EventArgs e)
{
createNewBeep();
txtStatus.Text += "[server started]\r\n";

}

private void btnStop_Click(object sender, EventArgs e)
{
btnStart.Enabled = true;
btnStop.Enabled = false;
myBeep.Stop();
txtStatus.Text += "[stopped]\r\n";

}

private void btnStart_Click(object sender, EventArgs e)
{
btnStart.Enabled = false;
btnStop.Enabled = true;
myBeep.Start();
txtStatus.Text += "[started]\r\n";

}
private void createNewBeep()
{
myBeep = new wodBeepCom();
myBeepProfile = new affinityBeepProfile();
myBeepTCP = new BeepTransportTCP();
myBeepTCP.DebugFile = "C:\affinityDebug.txt";
myBeepTCP.Port = 4397;
myBeep.Transport = (BeepTransport)myBeepTCP;
myBeepProfile.isServer = true;
myBeep.Profiles.Add(myBeepProfile);
myBeep.Role = BeepRoles.ListenerRole;
myBeep.Start();
//here is as good a place as any for events? :S
myBeep.Connected += new _IwodBeepComEvents_ConnectedEventHandler(myBeep_Connected);
myBeep.Disconnected += new _IwodBeepComEvents_DisconnectedEventHandler(myBeep_Disconnected);
myBeep.ChannelOpen += new _IwodBeepComEvents_ChannelOpenEventHandler(myBeep_ChannelOpen);
myBeepProfile.msgReceive += new affinityBeepProfile.onReceive(myBeepProfile_msgReceive);
++beepCount;
}

void myBeepProfile_msgReceive(object sender, onReceiveEventArgs e)
{
switch (e.messageAction)
{
case "UOB":
txtStatus.Text += "[user object] - ";
Stream myStream = new MemoryStream(ASCIIEncoding.Default.GetBytes(e.strBody));
XmlSerializer mySerial = new XmlSerializer(typeof(user));
myUser = (user)mySerial.Deserialize(myStream);
myStream.Close();
txtStatus.Text += myUser.affinityName.ToString() + "\r\n";

break;
}
}
void myBeep_ChannelOpen(BeepChannel Channel)
{
txtStatus.Text += "[new channel created] - " + Channel.ID + "\r\n";
}
}
}

Perhaps more information is needed in order for me to get help on this problem, but any insight would be great (I'm willing to give any more information that I can should anything more be needed to gain an understanding of what I'm trying to do - this isn't some top secret endevour Smile | :) )

Cheers all
QuestionTTH code in practical use... Pin
Smilik27-Feb-06 9:17
Smilik27-Feb-06 9:17 
Questiondirectx: how to turn of mesh smoothing? Pin
kopi_b27-Feb-06 8:43
kopi_b27-Feb-06 8:43 
QuestionRegarding DomainUpDown control Pin
Vijaykumar Rajaram27-Feb-06 8:40
Vijaykumar Rajaram27-Feb-06 8:40 
AnswerRe: Regarding DomainUpDown control Pin
Vijaykumar Rajaram27-Feb-06 9:09
Vijaykumar Rajaram27-Feb-06 9:09 
QuestionDebugging multithreaded C# windows app Pin
reduzent27-Feb-06 8:20
reduzent27-Feb-06 8:20 
AnswerRe: Debugging multithreaded C# windows app Pin
mikker_12327-Feb-06 10:30
mikker_12327-Feb-06 10:30 
GeneralRe: Debugging multithreaded C# windows app Pin
reduzent27-Feb-06 19:44
reduzent27-Feb-06 19:44 
GeneralRe: Debugging multithreaded C# windows app Pin
reduzent27-Feb-06 22:26
reduzent27-Feb-06 22:26 
GeneralRe: Debugging multithreaded C# windows app Pin
reduzent28-Feb-06 4:51
reduzent28-Feb-06 4:51 
QuestionPrimary key Ascending Pin
ytubis27-Feb-06 8:12
ytubis27-Feb-06 8:12 
AnswerRe: Primary key Ascending Pin
Steve Maier27-Feb-06 8:41
professionalSteve Maier27-Feb-06 8:41 
QuestionHow to delete a picture??? Pin
CrazyDragon638427-Feb-06 7:53
CrazyDragon638427-Feb-06 7:53 
AnswerRe: How to delete a picture??? Pin
mav.northwind27-Feb-06 8:04
mav.northwind27-Feb-06 8:04 
GeneralRe: How to delete a picture??? Pin
CrazyDragon638427-Feb-06 15:12
CrazyDragon638427-Feb-06 15:12 
GeneralRe: How to delete a picture??? Pin
mav.northwind27-Feb-06 20:08
mav.northwind27-Feb-06 20:08 
GeneralRe: How to delete a picture??? Pin
CrazyDragon638428-Feb-06 15:25
CrazyDragon638428-Feb-06 15:25 
GeneralRe: How to delete a picture??? Pin
mav.northwind28-Feb-06 21:28
mav.northwind28-Feb-06 21:28 

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.