sdlangers Posted January 7, 2003 Posted January 7, 2003 Hi All, Anyone know how to set the timeout value for a client socket thats trying to asynchronously connect to a server. I know this seems dumb since its connecting asynchronously, but i'd still like to shorten the timeout value. For example : client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP) ' set timeout value ' client.timeout ???? ' asynchronous connect client.BeginConnect(EP, AddressOf sockconnected, client) Thanks Quote
*Gurus* divil Posted January 8, 2003 *Gurus* Posted January 8, 2003 I don't believe so, only for sending and receiving data. I asked a friend, and he doesn't believe BSD sockets offer a way of doing this, he has unsuccessful in finding a way to do it with winsock and win32 either. Your best bet is probably to use a timer and do it yourself. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
sdlangers Posted January 8, 2003 Author Posted January 8, 2003 Hi, Thanks for your help.. ok, so if i use a timer.. how do i end the connection attempt after starting it asynchronously?.. i.e. would it not still try to fire the callback function whenever it does timeout? Thanks again for your help - im new enough to sockets Quote
*Gurus* divil Posted January 8, 2003 *Gurus* Posted January 8, 2003 I guess you could attempt to call the .Close method. It's not something I've ever had to do so I don't know. I guess if you closed the socket and disposed it, the callback wouldn't fire. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
sdlangers Posted January 8, 2003 Author Posted January 8, 2003 ok - thanks.. i'll try that and let ya know if i find out anything. thanks again Quote
dblood Posted November 12, 2003 Posted November 12, 2003 Long time in comming but here is a response m_DataSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 60000); m_DataSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 60000); This is more for people who are lookign for the answer now then to answer your question. I was looking and happend to find it in some example of FTP. Anyway, here it is. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.