|
Hey guys...
I have the last couple of days explored the beauty of SNMP protocol for smart network device programming using MIBs og OIDs.... But I was thinking, how does I get the mac address of a device, eg. connect to switch port number #12?
I have looked at the cisco example, but it seems to but the opposite case (you KNOw the mac address, and want to find the specific port on the siwtch).
In my case its like:
"You KNOW the PORT located on the switch, and want to extract the MAC address on the equipment connected to that specific port".
Any1 got an idea that could help me in the right direction?
|
|
|
|
|
Have a look at this[^]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
Thanks for your suggestions, but it didn't quiet make my solution. I'm looking for an API with a DLL I can use for this purpose, I want to use the existing SNMP protocol with correct MIBs and OIDs to collect and find the mac address on a switch port which is already known.
I have almost figured out at this time, how I locate a switch port based on a known mac address, but I want the opposite options if even possible?
My last thoughs was read the FDB table mib request (which should return all mac address' and portnumber for each?), and sort them after the port number? But I stumbled on it, cuz it seems that it returns some wrong bits (which ain't representing the MAC address in HEX string).
Any other suggestions, that could help me using the SNMP and mibs, collecting a mac address, on a KNOWN switch port?
|
|
|
|
|
hi
I wrote a windows service in c# that its starttype is aoutomatic but when I restart or start the computer it's not working. it is only working manual
why its happen??
thanks
|
|
|
|
|
Hi,
did you receive an error within the system-event log? If yes, could you post the error message?
Regards
Sebastian
|
|
|
|
|
no I didn't. also when restart comp. service's state is looking "beginning" and in event log says that "service start" but service's state is not to be "beginned"
|
|
|
|
|
Hmmm... maybe it hangs in the OnStart-event. Could you post the code of your OnStart()-method?
|
|
|
|
|
protected override void OnStart(string[] args)
{
inform("START");// for event log
timer1.Start();
proccessorid();//I give all system info
learnsystem();
Process.Start(string.Format("http://XXX.XXX.XX.X:4561/Default.aspx?proccessor_Id={0}",proccessor.ToString()));//I send system info a web page
}
|
|
|
|
|
I would suggest that you write to the event log after each call (timer1start(), processorid()...) This will show you when your service hangs...
|
|
|
|
|
no event log doesn't work after functions. but it is working manual succesfully
|
|
|
|
|
Ok, and after which function? You should try to log to the disk (fixed file would be sufficient first) so that you can reconstruct the point of failure...
|
|
|
|
|
"You should try to log to the disk"
How am I doing it??
|
|
|
|
|
|
sorry I didn't understand like this.I can it. I will test it too, thanks..
|
|
|
|
|
A wild guess is that the Process.Start can't run at that time (for whatever reason). Maybe put it in a try, wait and loop a few times if it fails.
for maybe three times
try
Process.Start
break
catch
wait a minute or so
Better yet, run that on a separate thread so the OnStart completes in a timely manner.
|
|
|
|
|
hi all
I put out the "Process.start" code, but it is not working.
Only first inform("start") works, anothers not work
Thats no problem on manual..
|
|
|
|
|
What does the code look like now?
|
|
|
|
|
protected override void OnStart(string[] args)
{
inform("START");// for event log
timer1.Start();
proccessorid();//I give all system info
learnsystem();
}
|
|
|
|
|
I think when I try learning proccesorid and all system info , the code is failed.
I put out them and service started normally in boot..
But I have to take those informations.
|
|
|
|
|
Get the learnsystem out of the OnStart; it doesn't belong there. OnStart must start the process and exit; that's all.
|
|
|
|
|
|
Probably in the main part of the Service -- perhaps check to see whether or not the system is learned:
If not learned
Try to learn
If failed, log and return
Do stuff
You could then periodically check for changes in the system, too.
|
|
|
|
|
also it is rarely working on restart..
|
|
|
|
|
Is your service dependent on another service? Then make sure that the other service is started before.
|
|
|
|
|
a lot of services start before which is depend on how am I understand?
|
|
|
|