Click here to Skip to main content
15,912,897 members
Home / Discussions / C#
   

C#

 
AnswerRe: Threading slows down whole application Pin
Andy Brummer15-Nov-05 5:46
sitebuilderAndy Brummer15-Nov-05 5:46 
GeneralRe: Threading slows down whole application Pin
smurfy3415-Nov-05 8:16
smurfy3415-Nov-05 8:16 
GeneralRe: Threading slows down whole application Pin
Andy Brummer15-Nov-05 11:32
sitebuilderAndy Brummer15-Nov-05 11:32 
AnswerRe: Threading slows down whole application Pin
kourvoisier15-Nov-05 10:36
kourvoisier15-Nov-05 10:36 
GeneralRe: Threading slows down whole application Pin
Robert Rohde15-Nov-05 11:16
Robert Rohde15-Nov-05 11:16 
GeneralRe: Threading slows down whole application Pin
kourvoisier15-Nov-05 11:27
kourvoisier15-Nov-05 11:27 
GeneralRe: Threading slows down whole application Pin
Andy Brummer15-Nov-05 11:37
sitebuilderAndy Brummer15-Nov-05 11:37 
QuestionARRGH!! Events are making me go bald Pin
Tom Wright15-Nov-05 5:20
Tom Wright15-Nov-05 5:20 
I do not seem to understand how events work in C#. I'm trying to write a sockets class that will fire off and event when the connection is made and or dropped. So I have a class call CMySocket.

In the namespace MySocket (outside of the class) I have my delegates
<br />
	public delegate void OnConnectHandler(CMySocket sender, EventArgs e);<br />
	public delegate void OnDisconnectHandler(CMySocket sender,EventArgs e);<br />


In the class I have the event handlers
<br />
		public event OnConnectHandler OnConnected;<br />
		public event OnDisconnectHandler OnDisconnected;<br />


I have a method called Connect()
<br />
	public void Connect()<br />
	{<br />
		m_socketClient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);<br />
		//MessageBox.Show("Connected");<br />
		IPEndPoint ipend = new IPEndPoint(Dns.Resolve(sIPaddress).AddressList[0],nPort);<br />
		m_socketClient.Connect((EndPoint)ipend);<br />
		if (OnConnected != null) OnConnected(this, new EventArgs());<br />
	}<br />

In my form class I have a method
<br />
		public void OnConnected(CMySocket mySocket, EventArgs e)<br />
		{<br />
			MessageBox.Show("Connected");<br />
		}<br />

But this method is never called from the event. What am I doing wrong. I thought I was following the tutorials correctly can some one please help

Thanks



Tom Wright
tawright915@yahoo.com
AnswerRe: ARRGH!! Events are making me go bald Pin
Russell Jones15-Nov-05 5:45
Russell Jones15-Nov-05 5:45 
GeneralRe: ARRGH!! Events are making me go bald Pin
Tom Wright15-Nov-05 6:48
Tom Wright15-Nov-05 6:48 
GeneralRe: ARRGH!! Events are making me go bald Pin
Tom Wright15-Nov-05 7:20
Tom Wright15-Nov-05 7:20 
Questiondatagrid question Pin
tadhg8815-Nov-05 5:02
tadhg8815-Nov-05 5:02 
AnswerRe: datagrid question Pin
AETaylor17-Nov-05 19:50
AETaylor17-Nov-05 19:50 
QuestionAppDomain scopes Pin
Den2Fly15-Nov-05 4:34
Den2Fly15-Nov-05 4:34 
AnswerRe: AppDomain scopes Pin
Andy Brummer15-Nov-05 11:45
sitebuilderAndy Brummer15-Nov-05 11:45 
GeneralRe: AppDomain scopes Pin
Den2Fly16-Nov-05 19:20
Den2Fly16-Nov-05 19:20 
QuestionFilter DataSet Pin
rich_wenger15-Nov-05 3:36
rich_wenger15-Nov-05 3:36 
QuestionCom+ DMZ Problem Pin
webhay15-Nov-05 2:34
webhay15-Nov-05 2:34 
AnswerRe: Com+ DMZ Problem Pin
Russell Jones15-Nov-05 4:41
Russell Jones15-Nov-05 4:41 
QuestionWeb Services - Type Marshaling Pin
akyriako7815-Nov-05 1:58
akyriako7815-Nov-05 1:58 
AnswerRe: Web Services - Type Marshaling Pin
Andy Brummer15-Nov-05 11:50
sitebuilderAndy Brummer15-Nov-05 11:50 
GeneralRe: Web Services - Type Marshaling Pin
akyriako7816-Nov-05 0:16
akyriako7816-Nov-05 0:16 
GeneralRe: Web Services - Type Marshaling Pin
rpurchas13-Dec-05 0:47
rpurchas13-Dec-05 0:47 
GeneralRe: Web Services - Type Marshaling Pin
akyriako7813-Dec-05 3:29
akyriako7813-Dec-05 3:29 
GeneralRe: Web Services - Type Marshaling Pin
rpurchas13-Dec-05 12:24
rpurchas13-Dec-05 12:24 

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.