Click here to Skip to main content
15,915,636 members
Home / Discussions / C#
   

C#

 
QuestionC# Async Socket Disconnect / Reconnect Pin
Sean Cornell14-May-08 13:34
Sean Cornell14-May-08 13:34 
been making a small telnet admin application for a game server for a couple months and i'm extreamly impressed with it thus far. I have had one major issue which has finally beaten me Big Grin | :-D sometimes (like all game servers) the server crashes, i can detect the exception and kill the socket. BUT i cannot re-connect until the application has ended.

I know its something to do with the socket keeping the local endpoint, even though it has been closed. I know this is the OS acting as it should, but i'm beaten to find out how to reconnect.

I'v had the reconnect in 3 states:

1) cannot access a disposed object (just close & beginConnect, no reconstruction of the socket)
2) Connection has already been established (CloseAndDuplicate - this happenes regaurdless of the IsConnected state)
3) BeginReceive is not called, (close -> re-construct the socket instantly)

i'v been monitoring the netstat for the connection and i'm not to sure what my targeted result is when i intend on re-connecting at the moment i'm just killing the connection as i have already tried to enter the CLOSE_WAIT state, in fairness i dont know enough about that side of things.

The code is pretty much the basic Async code provided via MSDN and snippets on this site.. If it is required let me know.

Many thanks

Sean
AnswerRe: C# Async Socket Disconnect / Reconnect Pin
The Nightcoder14-May-08 15:22
The Nightcoder14-May-08 15:22 
GeneralRe: C# Async Socket Disconnect / Reconnect Pin
Sean Cornell15-May-08 0:49
Sean Cornell15-May-08 0:49 
GeneralRe: C# Async Socket Disconnect / Reconnect Pin
The Nightcoder16-May-08 12:30
The Nightcoder16-May-08 12:30 
QuestionWinSxS Pin
Member 391904914-May-08 12:58
Member 391904914-May-08 12:58 
AnswerRe: WinSxS Pin
Christian Graus14-May-08 13:30
protectorChristian Graus14-May-08 13:30 
Question[Message Deleted] Pin
AAKAra14-May-08 10:23
AAKAra14-May-08 10:23 
AnswerRe: comparing the bit in C# Pin
PIEBALDconsult14-May-08 10:30
mvePIEBALDconsult14-May-08 10:30 
AnswerRe: [Message Deleted] Pin
Vikram A Punathambekar14-May-08 19:08
Vikram A Punathambekar14-May-08 19:08 
QuestionOnMouseMove event fires continually - Problem [modified] Pin
eliohim200514-May-08 10:20
eliohim200514-May-08 10:20 
AnswerRe: OnMouseMove event fires continually - Problem Pin
Ennis Ray Lynch, Jr.14-May-08 11:50
Ennis Ray Lynch, Jr.14-May-08 11:50 
GeneralRe: OnMouseMove event fires continually - Problem Pin
eliohim200515-May-08 4:05
eliohim200515-May-08 4:05 
GeneralRe: OnMouseMove event fires continually - Problem Pin
Ennis Ray Lynch, Jr.15-May-08 6:09
Ennis Ray Lynch, Jr.15-May-08 6:09 
QuestionItem already exist deployment error Pin
f_coy14-May-08 8:07
f_coy14-May-08 8:07 
Questionhow to give up cpu cycles Pin
LouMattera14-May-08 8:03
LouMattera14-May-08 8:03 
AnswerRe: how to give up cpu cycles Pin
Guffa14-May-08 8:16
Guffa14-May-08 8:16 
AnswerRe: how to give up cpu cycles Pin
Luc Pattyn14-May-08 9:35
sitebuilderLuc Pattyn14-May-08 9:35 
Questionproblem converting to object Pin
humayunlalzad14-May-08 7:46
humayunlalzad14-May-08 7:46 
AnswerRe: problem converting to object Pin
Csharp™14-May-08 8:30
Csharp™14-May-08 8:30 
GeneralRe: problem converting to object Pin
Guffa14-May-08 9:35
Guffa14-May-08 9:35 
AnswerRe: problem converting to object Pin
Guffa14-May-08 9:40
Guffa14-May-08 9:40 
GeneralRe: problem converting to object Pin
humayunlalzad14-May-08 19:57
humayunlalzad14-May-08 19:57 
GeneralRe: problem converting to object Pin
Guffa15-May-08 0:55
Guffa15-May-08 0:55 
GeneralRe: problem converting to object Pin
humayunlalzad15-May-08 5:09
humayunlalzad15-May-08 5:09 
GeneralRe: problem converting to object Pin
Guffa15-May-08 6:53
Guffa15-May-08 6:53 

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.