Click here to Skip to main content
15,896,201 members
Home / Discussions / C#
   

C#

 
GeneralRe: Is my C# app installed? Pin
Heath Stewart7-Sep-04 11:41
protectorHeath Stewart7-Sep-04 11:41 
GeneralRe: Is my C# app installed? Pin
cdengler7-Sep-04 13:20
cdengler7-Sep-04 13:20 
GeneralRe: Is my C# app installed? Pin
Heath Stewart7-Sep-04 17:25
protectorHeath Stewart7-Sep-04 17:25 
GeneralRe: Is my C# app installed? Pin
cdengler8-Sep-04 5:20
cdengler8-Sep-04 5:20 
GeneralRe: Is my C# app installed? Pin
Heath Stewart8-Sep-04 7:40
protectorHeath Stewart8-Sep-04 7:40 
GeneralRe: Is my C# app installed? Pin
cdengler8-Sep-04 13:29
cdengler8-Sep-04 13:29 
GeneralRe: Is my C# app installed? Pin
Heath Stewart8-Sep-04 13:46
protectorHeath Stewart8-Sep-04 13:46 
GeneralTcpListener Stop Pin
jzb6-Sep-04 21:41
jzb6-Sep-04 21:41 
I coding one programm:

private void button1_Click(object sender, System.EventArgs e)
{
thread = new Thread(new ThreadStart(ThreadFunc));
thread.Start();
}

public void ThreadFunc()
{
try
{
tcpListener = new TcpListener(IPAddress.Any, 8080) ;
tcpListener.Start ( ) ;

while (bConnect)
{
if (tcpListener != null)
{
m_socket = tcpListener.AcceptSocket();

if(m_socket.Connected)
{
Thread thread1 =new Thread(new ThreadStart(Receive));
thread1.Start();
}
}
}
}
catch(Exception exp)
{
MessageBox.Show(exp.Message);
}
}

protected void Receive()
{
int iRead = 0;
byte[] bts = new byte[1024];
while (true)
{
iRead = m_socket.Receive(bts);
if (iRead == 0) break;
byte[] btRead = new byte[iRead];
Array.Copy(bts, 0, btRead, 0, iRead);
string sTemp = Encoding.Default.GetString(btRead);
listBox1.Items.Add(sTemp);
}
}

private void button2_Click(object sender, System.EventArgs e)
{
this.bConnect = false;
}

private void button3_Click(object sender, System.EventArgs e)
{
DoSomething();
}

I want to dosomething when click button3. It can stop the listener, and exit the thread. but I get a same result, the programm can't close normally.



GeneralRe: TcpListener Stop Pin
leppie6-Sep-04 23:32
leppie6-Sep-04 23:32 
GeneralRe: TcpListener Stop Pin
mathon7-Sep-04 0:42
mathon7-Sep-04 0:42 
GeneralRe: TcpListener Stop Pin
jzb7-Sep-04 15:35
jzb7-Sep-04 15:35 
GeneralRe: TcpListener Stop Pin
mathon7-Sep-04 21:40
mathon7-Sep-04 21:40 
GeneralRe: TcpListener Stop Pin
jzb8-Sep-04 14:55
jzb8-Sep-04 14:55 
GeneralConvert Symbols in to equivalent numeric character reference Pin
Anonymous6-Sep-04 21:31
Anonymous6-Sep-04 21:31 
GeneralOut of memory exception Pin
chettu6-Sep-04 21:27
chettu6-Sep-04 21:27 
GeneralAdding dll's in C# setup projects Pin
samirazmat6-Sep-04 20:57
samirazmat6-Sep-04 20:57 
GeneralRe: Adding dll's in C# setup projects Pin
sreejith ss nair7-Sep-04 1:30
sreejith ss nair7-Sep-04 1:30 
GeneralRe: Adding dll's in C# setup projects Pin
samirazmat7-Sep-04 1:55
samirazmat7-Sep-04 1:55 
GeneralRe: Adding dll's in C# setup projects Pin
sreejith ss nair7-Sep-04 2:14
sreejith ss nair7-Sep-04 2:14 
GeneralRe: Adding dll's in C# setup projects Pin
samirazmat7-Sep-04 2:24
samirazmat7-Sep-04 2:24 
GeneralRe: Adding dll's in C# setup projects Pin
sreejith ss nair7-Sep-04 2:39
sreejith ss nair7-Sep-04 2:39 
GeneralRe: Adding dll's in C# setup projects Pin
sreejith ss nair7-Sep-04 2:40
sreejith ss nair7-Sep-04 2:40 
GeneralRe: Adding dll's in C# setup projects Pin
samirazmat7-Sep-04 3:27
samirazmat7-Sep-04 3:27 
GeneralRe: Adding dll's in C# setup projects Pin
sreejith ss nair7-Sep-04 3:39
sreejith ss nair7-Sep-04 3:39 
GeneralRe: Adding dll's in C# setup projects Pin
sreejith ss nair7-Sep-04 3:42
sreejith ss nair7-Sep-04 3:42 

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.