|
Ok that was it... Thanks a lot!;)
I'm still new to .NET so my mind didn't go that way...
Greetings,
Davy
|
|
|
|
|
First of all.. ive posted this question in 2 other forums without any luck (or responses)
so i thought id try this great forum with lots and lots of talented people
...
Ive had some problems getting the TcpListener under C# to find and accept
connections from a client with my client app and/or a simple telnet connection.
Connecting locally (localhost / 127.0.0.1) works fine but externally does not.
First i thought that it must be a firewall that was refusing the connections,
but even with it shut off (on both the server and client) i still cant get it to connect.
Has anyone had the same problem and if so, what should i do to fix it?
Im using WinXP Pro, .NET 1.1 and VS 2003.
Heres a simplified version of how i setup the tcp listener on the server:
// Initialize the tcp listener for connection clients
TcpListener tcpServerListener = new TcpListener(IPAddress.Any, 8002);
// Start the tcp listener
tcpServerListener.Start();
// Wait for an incomming connection from a client
Socket socket = tcpServerListener.AcceptSocket();
// Handle the connected client here
|
|
|
|
|
hello first my friend iam developing the same application and i had the same problems but i will solve all your problems then.
The problem in your application is
here
<br />
TcpListener server = new TcpListener(IpAddress.Any,8002);<br />
When you use IpAddress.Any
It listens for the default ip address of your windows xp even if you are connected to the internet . So you will have to make it listen for the ip address currently in use . So you will piece of code to your previous code as the following and the same for the client don't forget
<br />
IpAddress CurrentAddress = Dns.Resolve(Dns.GetHostName).AddressList[0];<br />
IpAddress CurrentAddress = Dns.Resolve(Environement.MachineName).AddressList[0];<br />
TcpListener server = new TcpListener(CurrentAddress,8002);<br />
i developed my application and i chatted with my friends through it on the internet and it works well but the problem i face now is that i need to enable the firewall immediately during installation of my messenger in their pcs through Win32 calls to SendMessage() functions but i don't know how .
If you have any solution for this it will be appreciated from you my friend.
Mess With The Best And Die Like The Rest
|
|
|
|
|
Thanks a lot for the help!
It finally works now, although i have to configure my firewall at work to let through connections as well as with a non-firewall system.
Im not quite sure i understand your problem, but perhaps something like this is
what youre asking for?
http://msdn.microsoft.com/msdnmag/issues/03/07/NET/
http://msdn.microsoft.com/msdnmag/issues/02/08/CQA/
Again, thanks for the help!
|
|
|
|
|
Thanks my friend for your help . Any Problem faces you in network programming just buzz me and send me the problem here
snouto@gmail.com
Mess With The Best And Die Like The Rest
|
|
|
|
|
i have pointer of the method with getFunctionPointer() but how can i call method using that pointer. There are no answer on hole Net and 666MSDN
winx
|
|
|
|
|
|
I never knew about function pointer in C#, but at a guess they would return a delegate, or function signature, not the actual function itself?
|
|
|
|
|
i think there is no such concept of "Function Pointer" in C#, it might implemented as a Delegate in C#
|
|
|
|
|
there also function Marshal.getDelegateForFunctionPointer(ptr,type) in 2.0 which make delegate from functionPointer (IntPtr) obtained by RuntimeMethodHandle.getFunctionPointer. I try to call function just by its address (function pointer) and there is no any article on all web There is many on C++ DLL which is microsoft base attention ......
winx
|
|
|
|
|
Hi,
I have two assemblies, strong name signed by using the same signing key file. One assembly opens the other assembly using reflection. In order to check whether it is the original assembly (created by me) that I am opening I would like to compare the strong name key of the two applications (which is the main proof that I created the second assembly and not somebody else).
How do I do this? Assembly.GetName().GetPublicKey() seems the hash code of the assembly encrypted by de private key, instead of the public key.
Thank you,
Gidon
|
|
|
|
|
|
|
Hey howzit,
How can I create a textbox in runtime. for e.g. I just a button and then it creates a textbox on the form.
Can you please give me all the code i need, that would be a huge help!
Thanks
|
|
|
|
|
TextBox MyBox = new TextBox();
MyBox.Text = "Hi TextBox \n New Line";
MyBox.Multiline = true;
MyBox.Size = new Size ( 50, 60 );
MyBox.Location = new Point ( 20, 20 );
this.Controls.Add ( MyBox );
Ahmad Shaban
|
|
|
|
|
|
How do I bring the control to the front programmatically.
When the textbox is created, it appears behind the Panel instead of on top of it!
|
|
|
|
|
There's two ways
1) if you want to add the textbox to the panel
You replace the last line of code
this.Controls.Add ( MyBox );
with
MyPanel.Controls.Add ( MyBox );
2)use
MyBox.BringToFront();
please take a look at my program Startup Editor[^]
and rate my reply please 5 would be fine
Ahmad Shaban
-- modified at 6:57 Thursday 26th January, 2006
|
|
|
|
|
|
This is really cool. You could have a toolbar button that (when a registry item is selected) opens Regedit and goes to the key.
|
|
|
|
|
Can we achieve an child-parent lookup when we establish an object binding ?
Sorry i cant express it well so i'll give an example:
Let's suppose we have class Student and a class Classroom related in a way as follows.
class Classroom
{
public string Name {get;set;}
public string Code {get;set;}
}
We load from a db and get an Classroom[] { a , b , c , d}.
class Student
{
public string Name {get;set;}
public Classroom ClassRoom {get;set;}
}
We load students from a db.
Is this possible to bind Student.ClassRoom to a combobox which simultaneously be a lookup table deriving Classroom values from Classroom[] object i've already loaded and submit changes to the current student object of the binding source ?
I have done it with datasets so i assume it can be done with objects but project requirements exclude typed dataset and it's obligatory to use business objects.
It's not a homework , i'm not asking the code just a guideline or a decent data binding articles for .net 2.0 .
Thanx in advance.
|
|
|
|
|
How do I get what type of disc is in my cd/dvd drive?
I have been looking around in the WMI (Windows Management Instrumentation) and found Win32_PhysicalMedia and Win32_CDROMDrive but I don't know how to link them together or how to use Win32_PhysicalMedia to get the info of the discs in my drive.
Win32_PhysicalMedia.MediaType specifies the type of media (CD-R,DVD+RW,DVD-RAM etc.) but when I enumerate Win32_PhysicalMedia I only get info for my hard disks.
How do I do it? Is there an easier way than using WMI?
MajorPaul
|
|
|
|
|
WMI won't tell you what type of media is in the drive. It works with the drive itself and the POSSIBLE media's the drive can use.
You actually have to do low-level reading of the disk to deteremine what the media type is. But, I have no idea what to look for on the disk to determine its type.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks... I'll just have to skip that feature in my program then.
MajorPaul
|
|
|
|
|
Hi.
In C# (VS2003 and not VS2005) how can play sound?
I have a clock and it has alarm. I want to play a sound for alarm.
Best wishes
|
|
|
|