Click here to Skip to main content
15,920,602 members
Home / Discussions / C#
   

C#

 
AnswerRe: Dll Versions Pin
Manas Bhardwaj14-Jun-07 22:39
professionalManas Bhardwaj14-Jun-07 22:39 
GeneralRe: Dll Versions Pin
umashankergr814-Jun-07 23:12
umashankergr814-Jun-07 23:12 
GeneralRe: Dll Versions Pin
Mali Perica15-Jun-07 3:55
Mali Perica15-Jun-07 3:55 
QuestionHow to avoid reading first three lines in a text file? Pin
meeram39514-Jun-07 21:15
meeram39514-Jun-07 21:15 
AnswerRe: How to avoid reading first three lines in a text file? Pin
lmoelleb14-Jun-07 22:24
lmoelleb14-Jun-07 22:24 
AnswerRe: How to avoid reading first three lines in a text file? Pin
RugbyLeague15-Jun-07 1:28
RugbyLeague15-Jun-07 1:28 
GeneralRe: How to avoid reading first three lines in a text file? Pin
khuzwayom15-Jun-07 3:37
khuzwayom15-Jun-07 3:37 
QuestionCan a timer run within a thread in c# Pin
hellotkb14-Jun-07 21:14
hellotkb14-Jun-07 21:14 
I am creating programs that send and receive files using TCP protocol.
A client and server modules are created and communication between them is through "System.Net.Sockets". Thread is needed for listening to client connection request.

The connection between server and client is restricted to 30 minutes. In my program, the server module enables a 30 min timer when there is a client connection . The timer tick method should be called to disconnect the client after 30 min.

Problem is the tick method is not executed even though the timer is enabled. Pls help if you know where have got wrong. Thanks in advance.

My code at server module:

<u>listen to client</u>
th = new Thread(new ThreadStart(ListenForPeers));
th.IsBackground = true;
th.Start();

<u>ListenForPeers</u>
public void ListenForPeers()
{
//=====Standard socket method======
serversocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

serversocket.Blocking = true ;
IPHostEntry IPHost = Dns.Resolve(server);
string []aliases = IPHost.Aliases;
PAddress[] addr = IPHost.AddressList;
IPEndPoint ipepServer = new IPEndPoint(System.Net.IPAddress.Parse(IP_ADDRESS.Text), 8090);

serversocket.Bind(ipepServer);
serversocket.Listen(-1);

while (runThread) //<<====Start thread to listen to client connection, when server is ready ===
{
clientsock = serversocket.Accept();
if ( clientsock.Connected )
{
total_clients_connected++; // increment client connection counter
if(connectionTimer.Enabled == false) //<<===Enable the timer if it is not able==
{ connectionTimer.Enabled = true; //<<=== Start 30 min timer
}
Thread tc = new Thread(new ThreadStart(listenclient)); //listen to client command call
tc.IsBackground = true;
tc.Start();


}
}
}











AnswerRe: Can a timer run within a thread in c# Pin
MidwestLimey15-Jun-07 5:23
professionalMidwestLimey15-Jun-07 5:23 
GeneralRe: Can a timer run within a thread in c# Pin
hellotkb18-Jun-07 22:19
hellotkb18-Jun-07 22:19 
Questionhow to access/read registry of a remote system Pin
devesh_code14-Jun-07 20:02
devesh_code14-Jun-07 20:02 
AnswerRe: how to access/read registry of a remote system Pin
Christian Graus14-Jun-07 21:09
protectorChristian Graus14-Jun-07 21:09 
GeneralRe: how to access/read registry of a remote system Pin
devesh_code14-Jun-07 21:20
devesh_code14-Jun-07 21:20 
AnswerRe: how to access/read registry of a remote system Pin
ScottM115-Jun-07 1:14
ScottM115-Jun-07 1:14 
GeneralRe: how to access/read registry of a remote system Pin
Dave Kreskowiak15-Jun-07 3:37
mveDave Kreskowiak15-Jun-07 3:37 
QuestionException while loading XslTransform Pin
Abhi Lahare14-Jun-07 19:58
Abhi Lahare14-Jun-07 19:58 
QuestionBinaryFormatter -> Invalid binaryHeader Pin
hansipet14-Jun-07 19:48
hansipet14-Jun-07 19:48 
AnswerRe: BinaryFormatter -> Invalid binaryHeader Pin
Soleil couchant14-Jun-07 22:55
Soleil couchant14-Jun-07 22:55 
GeneralRe: BinaryFormatter -> Invalid binaryHeader Pin
hansipet14-Jun-07 23:19
hansipet14-Jun-07 23:19 
GeneralRe: BinaryFormatter -> Invalid binaryHeader Pin
Rudolf Jan15-Jun-07 0:20
Rudolf Jan15-Jun-07 0:20 
GeneralRe: BinaryFormatter -> Invalid binaryHeader Pin
hansipet15-Jun-07 2:39
hansipet15-Jun-07 2:39 
GeneralRe: BinaryFormatter -> Invalid binaryHeader Pin
Rudolf Jan18-Jun-07 9:27
Rudolf Jan18-Jun-07 9:27 
GeneralRe: BinaryFormatter -> Invalid binaryHeader Pin
hansipet18-Jun-07 19:32
hansipet18-Jun-07 19:32 
GeneralRe: BinaryFormatter -> Invalid binaryHeader Pin
Rudolf Jan19-Jun-07 10:06
Rudolf Jan19-Jun-07 10:06 
GeneralRe: BinaryFormatter -> Invalid binaryHeader Pin
hansipet19-Jun-07 19:30
hansipet19-Jun-07 19: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.