Click here to Skip to main content
15,913,587 members
Home / Discussions / C#
   

C#

 
QuestionA sample project Pin
mehrdadc4814-May-08 15:52
mehrdadc4814-May-08 15:52 
AnswerRe: A sample project Pin
Christian Graus14-May-08 16:25
protectorChristian Graus14-May-08 16:25 
Questionwhat is this mean Pin
angels77714-May-08 15:07
angels77714-May-08 15:07 
AnswerRe: what is this mean Pin
Christian Graus14-May-08 15:21
protectorChristian Graus14-May-08 15:21 
JokeRe: what is this mean Pin
Vikram A Punathambekar14-May-08 19:07
Vikram A Punathambekar14-May-08 19:07 
AnswerRe: what is this mean Pin
Ashfield14-May-08 21:17
Ashfield14-May-08 21:17 
QuestionC# Async Socket Disconnect / Reconnect Pin
Sean Cornell14-May-08 13:34
Sean Cornell14-May-08 13:34 
AnswerRe: C# Async Socket Disconnect / Reconnect Pin
Peter Josefsson Sweden14-May-08 15:22
Peter Josefsson Sweden14-May-08 15:22 
I'm not sure I understand if you're client-side or server-side... I can see uses for both in game server scenarios (client for running automated tasks against an existing telnet game server interface - server for providing a telnet interface for a local game server that doesn't have one) and your text doesn't make that very clear (at least not to me).

In any case - here are my two cents - for either scenario.

If you're client-side:

You should be able to reconnect immediately (as the new connection uses a new source port). However, if you try to reuse your socket, chances are that BAD things will happen. From the docs: "Call the Close method to free all managed and unmanaged resources associated with the Socket. Do not attempt to reuse the Socket after closing.". So... close your socket, replace it with a brand new one and start over. Shouldn't be a problem unless you gave away a reference to the socket to someone and can't make sure they replace it with a reference to your new socket (have seen that). Sorry... back to the drawing board in that case... no (trustworthy) workaround.

If you're server-side:

Try mySocket.LingerState = new LingerOption(false, 0); before calling Close. Otherwise, the socket will try to send any unsent data (holding the server TCP port busy) until the app terminates. Worked like a charm in my stacker crane management system (one of the crane PLCs for some reason insisted that I, the client, should be the TCP server and that it, the server, should be the TCP client - go figure). Had exactly the problem you describe every time I tried to do a warm restart (without exiting the app). No more.

Later,

--
Peter

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
Peter Josefsson Sweden16-May-08 12:30
Peter Josefsson Sweden16-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 

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.