Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / June 2006

Tip: Looking for answers? Try searching our database.

Very urgent

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
alok sengar - 08 Jun 2006 06:50 GMT
hi,
    I have already tried this URL's code
"http://www.java2s.com/Code/CSharp/Network/SimpleSNMP.htm"
but I am getting error when i am creating a UDP type Socket and recieving
packet from this socket.
some time error is---"An existing connection was forcibly closed by the
remote host"
and some time error is---
"A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond"

i am using this code for

try

{

IPHostEntry ihe = Dns.GetHostEntry(host);

IPEndPoint iep = new IPEndPoint(ihe.AddressList[0], 161);

EndPoint ep = (EndPoint)iep;

Socket sock = new Socket(ep.AddressFamily, SocketType.Dgram,
ProtocolType.Udp);

sock.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, 1000);

sock.Connect(iep);

sock.SendTo(packet, snmplen, SocketFlags.None, iep);

//Receive response from packet

try

{

packet = new byte[1024];

int recv = sock.ReceiveFrom(packet, ref ep);

//here I am getting above written exceptions

catch (SocketException ex)

{

packet[0] = 0xff;

}

pls help me out of this its very urgent.
thanks
alok sengar
George Birbilis - 14 Jun 2006 11:33 GMT
> "A connection attempt failed because the connected party did not properly
> respond after a period of time, or established connection failed because
> connected host has failed to respond"

have you tried using a bigger timeout value?

Signature

---------------
George Birbilis <birbilis@kagi.com>
Microsoft MVP J# 2004-2006
Borland Spirit of Delphi
http://www.kagi.com/birbilis


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.