|
yeah that's good possibility. Only problem could be to find icons descriptive enough. But, maybe it's not as problematic as find real picures...
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Yes, this sounds interesting as well, however needs much more work to implement than the other direction.
I am gonna figure out what I am gonna do and let u know guys.
Thanx for ur directions.. really interesting
|
|
|
|
|
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 />
do<br />
{<br />
try<br />
{<br />
listBox1.Items.Add("Waiting for connection");<br />
connection = server.AcceptSocket();<br />
socketstream = new NetworkStream(connection);<br />
reader = new BinaryReader(socketstream);<br />
writer = new BinaryWriter(socketstream);<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
|
|
|
|
|
There is one problem in your code. All the code runs on one thread - so you just can handle one connection.
To avoid this effect you should start one thread per client.
At the point where you accept the socket you shoul openn a new thread and give it the socket.
As a result the main thread isn't blocked anymore and can accept new connections.
So it should be possible to handle multiple connections.
|
|
|
|
|
you mean my friend that i will add new thread after the code that accept the socket connection upon client request
you mean my code will be like that
-------------------------------------------------
public void runserver()
{
int counter = 1;
try
{
server = new TcpListener(5151);
server.Start();
//loop until recieveing connection request from the clients
do
{
try
{
//inform at the server side that it is waiting for connection
//from clients
listBox1.Items.Add("Waiting for connection");
//intialize new socket connection upon client request
connection = server.AcceptSocket();
//////////////////////////////////////////////////////
//here what did you told me... you mean like that
Thread Anotherthread = new thread(new threadstart(runserver));
Anotherthread.start();
/////////////////////////////////////////////////////
//intialize new network stream connection
socketstream = new NetworkStream(connection);
//intialize new binary reader and binary writer to the network
reader = new BinaryReader(socketstream);
writer = new BinaryWriter(socketstream);
//inform the user that there was new client connection
writer.Write("server :" + " Welcome Client");
listBox1.Items.Add("Connection " + counter + " Recieved");
string message ="";
do
{
message = reader.ReadString();
listBox1.Items.Add(message);
}while(connection.Connected);
}
catch(Exception)
{
break;
}
listBox1.Items.Add("Client Terminated the connection");
connection.Close();
reader.Close();
writer.Close();
socketstream.Close();
++counter;
}while(true);
}
catch(System.Exception caught)
{
MessageBox.Show(caught.Message);
}
}
Miss With The Best And Die Like The Rest
|
|
|
|
|
I wrote a program that I call GameServer that can be run either in server or client mode (i.e. you would run one instance to fill the role of "server" then you can have multiple "client" instances). The server accepts and identifies the individual clients and even has "chat" windows that are displayed on each client box that get updated from every connected client.
If you would like to see this code I can zip it up and e-mail it to you - just let me know. You could pull the essential elements out of the code and use what you need.
dpb
Darryl Borden
Principal IT Analyst
dborden@eprod.com
|
|
|
|
|
Hi , i am actually beginner with C#, so i have a simple question. I Have a form "Form1.cs" and "Form2.cs" so
when i press button , in "Form1.cs" , i want simply the Form2 dialog to show up.
And one more thing how can i programatically set font
of a textBox ??
Regards
m0n0
m0n0
|
|
|
|
|
1st question:
If you want to show a second window you hav 2 option - show it as dialog or as free window
here a sample to show it as dialog (the easier way):
Form2 f = new Form2();
f.ShowDialog();
2nd question:
you can change the font of a textbox in the following way (this is the visual studio auto generated code if you change it in the designer):
this.textBox1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
|
|
|
Thanks hooray for attention.
Could you help me with one more problem ,
i want to save to text file(*.txt) what textBox contains
Thanks in advance
m0n0
|
|
|
|
|
you just have to open an streamwriter object (in the namespace System.IO) and then write the string to the file.
string str = textBox1.Text;
StreamWriter sw = new StreamWriter(@"1.txt");
sw.Write(str);
sw.Close();
|
|
|
|
|
Thanks!
i guess @ means that the file will be saved there from where the program is launched? and is there smth like @ but the file will be saved in windows folder.(like regedit has
%system%).
And i have problems setting oppacity programatically, i do following
this.Oppacity = 50;
but it does not work , i think it needs smth like Updatedata() ???
Best Regards.
m0n0
|
|
|
|
|
the @ means the special chars like '\' will not be interpreted.
for example:
@"c:\1.txt" == "c:\\1.txt"
(for me - I just getting used to use it as standard)
The Opacity could not be set to the value of 50. The Opacity is a float value - so if you like to reach 50% opacity you should set it to 0.5
|
|
|
|
|
|
hi,
i have a problem with the window_moved event of the internet explorer. i have an IWebBrowserApp object and get the events through a DWebBrowserEvents2_Event interface. i connect the browser object to the events with the following code:
member_WebBrowserEvents2 = member_IWebBrowserApp as SHDocVw.DWebBrowserEvents2_Event;
then i delegate the setLeft event handler to my function with the following code:
member_WebBrowserEvents2.WindowSetLeft += new SHDocVw.DWebBrowserEvents2_WindowSetLeftEventHandler(SetLeftFunction);
this doesn't work . all other events like e.g. TitleChange or OnQuit work. i need the event when the user moves or resizes the browser window. the WindowMove event listener of the SHDocVw.DWebBrowserEvents_Event interface doesn't work too. does anyone has a solution for this problem?
thanks for help
|
|
|
|
|
I have just completed a big C# project and have descoverd that i have to create a variable list, i was wondering if there is a way of automatically creating this in visual studio. or do i have to go through each line to manualy create it?
any help?
|
|
|
|
|
|
A list of the variable names for strings, int, char and arrays. it also can have object names like memory streams and networkstreams.
i hope thats cleard it up a bit
|
|
|
|
|
I don't think there's something like this in VS (well, intellisense and the member dropdowns use this info, but I don't think you can export it).
But using reflection you can build this functionality on your own.
Regards,
mav
|
|
|
|
|
hi
if i have the yaw,pitch,roll angels and the legnth of an obect (line for example) which is drawen for example from point 0,0,0 how can i calculate the coordinates of the end of line point (x,y,z)
thanks for help
|
|
|
|
|
First of all I have to say, that I really have some difficulties to understand what your problem is!
There seems to be a problem with your question!
When you have a line starting at one point, and you also got the 3 angles vor x, y and z, then you need to know the length of that line to calculate the end point!
Have a look at vector maths.
Don't try it, just do it!
|
|
|
|
|
hi
thanks for your reply
i already tried to make that using the matrixtransformation but the output is not correct :
x1=X*m.M11+Y*m.M21+Z*m.M31+1*m.M41;
y1=X*m.M12+Y*m.M22+Z*m.M32+1*m.M42;
z1=X*m.M13+Y*m.M23+Z*m.M33+1*m.M43;
where x1,y1,z1 is the new point of the old x,y,z point after the rotation Matrix m is applied which contains the yaw,pitch,roll rotations
so what is the problem ? any suggestions?
thanks
|
|
|
|
|
Hi there on CodeProject. This is my very first post here.
I need a quick an easy way of building a visual tree (n-ary with the root at the top) in C# using some sort of extra GUI graphics package. I have looked at the netron project website but i choose to create a thread here since i need a quick an painless solution - fast. I am new to C# but have a good understanding of OOP from experience with Java.
So if somebody know how to do this - please give some tips or better yet - some source code I know of the TreeView Class, but it do not like the way it is drawn. I need the tree with the nodes of the same level/height drawn adjacent to eachother.
You know - like this:
() (root)
/\
/ \
() ()
/\ \
/ \ \
() () ()
Please - I need this to work fast.
Intel4004
|
|
|
|
|
In this case you should create a UserControl and then override the OnPaint method.
After that you can start to draw this tree by your own.
As far as I know there is no easier way to do this and there is no way around to do the drawing by your own.
|
|
|
|
|
Hello,
I have written Client and Server applications in C-Sharp language. They are communication with each others using sockets. The problem is that when client connects to the server, and if i disable the network (disconnect the network cable) at client side, it does not give any notification at the Server side that client is abnormally disconnected. I have put the code in try...catch, where I am reading client stream and i expect that i get an exception at server side in this case... but i don't (Note: I do get exception here if my client and server are running on same machine).
Anybody has any idea how to handle such situation.
Thanks,
Kamran
|
|
|
|
|
You shuld implement somethink like a check, maybe every 3sec a ping or somethink.
|
|
|
|