Click here to Skip to main content
15,919,479 members
Home / Discussions / C#
   

C#

 
GeneralRe: Help with a Dental application... Pin
DavidNohejl9-Apr-05 10:56
DavidNohejl9-Apr-05 10:56 
GeneralRe: Help with a Dental application... Pin
Polis Pilavas9-Apr-05 11:47
Polis Pilavas9-Apr-05 11:47 
GeneralRe: Help with a Dental application... Pin
DavidNohejl9-Apr-05 12:43
DavidNohejl9-Apr-05 12:43 
GeneralRe: Help with a Dental application... Pin
Polis Pilavas9-Apr-05 13:13
Polis Pilavas9-Apr-05 13:13 
GeneralRe: Help with a Dental application... Pin
turbochimp9-Apr-05 18:55
turbochimp9-Apr-05 18:55 
GeneralRe: Help with a Dental application... Pin
DavidNohejl10-Apr-05 1:30
DavidNohejl10-Apr-05 1:30 
GeneralRe: Help with a Dental application... Pin
Polis Pilavas10-Apr-05 1:49
Polis Pilavas10-Apr-05 1:49 
Generalin god sake help me iam sinking in deep blue sea Pin
snouto9-Apr-05 9:15
snouto9-Apr-05 9:15 
i told all of you before that i am designing new chat messenger but i really find some great troubles in my application i really want help from anybody knows how to deal with C# networking and its facilities in that type of things.........

>>>> at the server side<<<<<<<
here i created void method to handle the connection of clients upon specific port ...
and i created new thread to handle the connection of multiusers who will connect to the server at any time

and i replaced my thread in the constructor of my main program

as
..............................................
Thread readthread = new thread( new threadstart(runserver));
readthread.start();
...................

and that method in that delegate is like that

...........................................
public void runserver()<br />
		{<br />
			int counter = 1;<br />
			try<br />
			{<br />
				server = new TcpListener(5151);<br />
				server.Start();<br />
				//loop until recieveing connection request from the clients<br />
				do<br />
				{<br />
					try<br />
					{<br />
						//inform at the server side that it is waiting for connection<br />
						//from clients<br />
						listBox1.Items.Add("Waiting for connection");<br />
						//intialize new socket connection upon client request<br />
						connection = server.AcceptSocket();<br />
						//intialize new network stream connection<br />
						socketstream  = new NetworkStream(connection);<br />
						//intialize new binary reader and binary writer to the network<br />
						reader = new BinaryReader(socketstream);<br />
						writer = new BinaryWriter(socketstream);<br />
						//inform the user that there was new client connection<br />
						writer.Write("server :" + " Welcome Client");<br />
						listBox1.Items.Add("Connection " + counter + " Recieved");<br />
						string message ="";<br />
						do<br />
						{<br />
							message = reader.ReadString();<br />
							listBox1.Items.Add(message);<br />
<br />
						}while(connection.Connected);<br />
					}<br />
					catch(Exception)<br />
					{<br />
						break;<br />
					}<br />
					listBox1.Items.Add("Client Terminated the connection");<br />
					connection.Close();<br />
					reader.Close();<br />
					writer.Close();<br />
					socketstream.Close();<br />
					++counter;<br />
				}while(true);<br />
			}<br />
			catch(System.Exception caught)<br />
			{<br />
				MessageBox.Show(caught.Message);<br />
			}<br />
		}<br />

that worked with me when i started my server application and started my client application . It only accepted one client connection but when i tried to start new client window it didn't accept it and nothing was written on my second client window like the proper message in the previous code ((Writer.write("Server:Welcome Client");)
tell me in god sake how can i make it accept clients not only one client


i will be very thoughtful for any help

thank you your brother

>>>>>Snouto Override<<<<<<




Miss With The Best And Die Like The Rest
GeneralRe: in god sake help me iam sinking in deep blue sea Pin
hooray9-Apr-05 9:23
hooray9-Apr-05 9:23 
GeneralRe: in god sake help me iam sinking in deep blue sea Pin
snouto10-Apr-05 0:16
snouto10-Apr-05 0:16 
GeneralRe: in god sake help me iam sinking in deep blue sea Pin
Darryl Borden11-Apr-05 8:32
Darryl Borden11-Apr-05 8:32 
GeneralOpen form Pin
ddmcr9-Apr-05 7:58
ddmcr9-Apr-05 7:58 
GeneralRe: Open form Pin
hooray9-Apr-05 8:34
hooray9-Apr-05 8:34 
GeneralRe: Open form Pin
ddmcr9-Apr-05 8:46
ddmcr9-Apr-05 8:46 
GeneralRe: Open form Pin
hooray9-Apr-05 8:54
hooray9-Apr-05 8:54 
GeneralRe: Open form Pin
ddmcr9-Apr-05 9:27
ddmcr9-Apr-05 9:27 
GeneralRe: Open form Pin
hooray9-Apr-05 9:32
hooray9-Apr-05 9:32 
GeneralRe: Open form Pin
ddmcr9-Apr-05 9:42
ddmcr9-Apr-05 9:42 
Generalwindow_moved event in internet explorer Pin
Pikebu9-Apr-05 7:50
Pikebu9-Apr-05 7:50 
GeneralVariable list Pin
Anonymous9-Apr-05 5:18
Anonymous9-Apr-05 5:18 
GeneralRe: Variable list Pin
leppie9-Apr-05 6:40
leppie9-Apr-05 6:40 
GeneralRe: Variable list Pin
Anonymous9-Apr-05 6:48
Anonymous9-Apr-05 6:48 
GeneralRe: Variable list Pin
mav.northwind9-Apr-05 23:33
mav.northwind9-Apr-05 23:33 
Questioncalculations problem in directx? Pin
taha mohamed9-Apr-05 4:16
taha mohamed9-Apr-05 4:16 
AnswerRe: calculations problem in directx? Pin
Alexander M.,9-Apr-05 8:05
Alexander M.,9-Apr-05 8:05 

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.