Click here to Skip to main content
15,920,896 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to retreive correct control.visible property of a hidden control in c# Pin
Luc Pattyn31-Oct-08 12:21
sitebuilderLuc Pattyn31-Oct-08 12:21 
QuestionRe: how to retreive correct control.visible property of a hidden control in c# Pin
nelsonpaixao31-Oct-08 13:49
nelsonpaixao31-Oct-08 13:49 
AnswerRe: how to retreive correct control.visible property of a hidden control in c# Pin
Dave Kreskowiak1-Nov-08 5:20
mveDave Kreskowiak1-Nov-08 5:20 
QuestionList<int> in wpf designer</int> [modified] Pin
vincentgr31-Oct-08 8:02
vincentgr31-Oct-08 8:02 
AnswerRe: List in wpf designer Pin
Pedram Behroozi31-Oct-08 8:16
Pedram Behroozi31-Oct-08 8:16 
GeneralRe: List in wpf designer Pin
vincentgr31-Oct-08 8:33
vincentgr31-Oct-08 8:33 
GeneralRe: List in wpf designer Pin
Pedram Behroozi31-Oct-08 8:41
Pedram Behroozi31-Oct-08 8:41 
QuestionSNMP Trap or Packet Listner Program --Socket Question. Please advice Pin
jobin00700731-Oct-08 7:23
jobin00700731-Oct-08 7:23 
I am trying to create a program to listen to SNMP traps send out by a device randomly and quite frequently.
I am a newbie to network programming. I found out that i have to create an asyncronous connection to the port and then listen to the packet using an event handler. My problem is that my current program only listens to one trap and then stops listening. i have to call it again to start listening again.

------ ----------------------------------My Main program-------------------------------------------------------

SocketAsyncEventArgs e = new SocketAsyncEventArgs();

IPEndPoint Ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 162);
EndPoint Remote = (EndPoint)(sender);


Qumax_Socket.Bind(Ipep);

bool Event_Connect = false;
e.SetBuffer(data,0,200);
e.RemoteEndPoint = Remote;
e.AcceptSocket = Qumax_Socket;

Qumax_Socket.ConnectAsync(e); //CONNECTS ASYNCRONOUSLY


e.Completed += new EventHandler<socketasynceventargs>(this.e_Completed); //EVENT HANDLER FOR TRAP RECIEVE
Qumax_Socket.ReceiveAsync(e); //ACTIVATE RECIEVE TRAPS


------ ----------------------------------My Recieve handler---------------------------------------------------------

void e_Completed (object sender, SocketAsyncEventArgs e)
{
////Code to recieve handler..Deleted for now.////
Qumax_Socket.ReceiveAsync(e); //Call recieve handler again.
}

So looking at my recieve handler i need to call the receeve traps again to listen to more than one trap. If "Qumax_Socket.ReceiveAsync(e);" line is missing the program recieves to one trap and stops.

My worry is that there is a time interval between receiving of the first trap and calling the receieve function again during which a trap send by the remote machine would be missed. This time delay is equal to the code in the recieve handler.Is this something to worry about?

Is there a better way to do this with .NET sockets?

Please let me know.

Thanks
AnswerRe: SNMP Trap or Packet Listner Program --Socket Question. Please advice Pin
jobin0070075-Nov-08 15:54
jobin0070075-Nov-08 15:54 
QuestionTabControl question Pin
aalex67531-Oct-08 6:29
aalex67531-Oct-08 6:29 
AnswerRe: TabControl question Pin
Pedram Behroozi31-Oct-08 7:33
Pedram Behroozi31-Oct-08 7:33 
GeneralRe: TabControl question Pin
aalex67531-Oct-08 7:37
aalex67531-Oct-08 7:37 
GeneralRe: TabControl question Pin
Pedram Behroozi31-Oct-08 7:56
Pedram Behroozi31-Oct-08 7:56 
QuestionHow to get a list of open files? Pin
Dirk.Bock31-Oct-08 5:40
Dirk.Bock31-Oct-08 5:40 
AnswerRe: How to get a list of open files? Pin
Eddy Vluggen31-Oct-08 5:57
professionalEddy Vluggen31-Oct-08 5:57 
AnswerRe: How to get a list of open files? Pin
Giorgi Dalakishvili31-Oct-08 8:42
mentorGiorgi Dalakishvili31-Oct-08 8:42 
QuestionMerchant Connect - Webservice anyone? Pin
sameerhanda31-Oct-08 5:37
sameerhanda31-Oct-08 5:37 
AnswerRe: Merchant Connect - Webservice anyone? Pin
Paul Conrad31-Oct-08 7:34
professionalPaul Conrad31-Oct-08 7:34 
Questionlistbox population Pin
arkiboys31-Oct-08 5:27
arkiboys31-Oct-08 5:27 
AnswerRe: listbox population Pin
Eddy Vluggen31-Oct-08 5:48
professionalEddy Vluggen31-Oct-08 5:48 
GeneralRe: listbox population Pin
Luc Pattyn31-Oct-08 7:14
sitebuilderLuc Pattyn31-Oct-08 7:14 
Questionthreading Pin
arkiboys31-Oct-08 5:25
arkiboys31-Oct-08 5:25 
AnswerRe: threading Pin
Eddy Vluggen31-Oct-08 5:53
professionalEddy Vluggen31-Oct-08 5:53 
AnswerRe: threading Pin
Guffa31-Oct-08 6:48
Guffa31-Oct-08 6:48 
AnswerRe: threading Pin
aalex67531-Oct-08 6:50
aalex67531-Oct-08 6:50 

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.