|
1. You must find it manually. It likes "find house number 2000", but in which city ? which street ?
2. Read first, how TCPIP works. You cannot connect to server if you don't know the IP address.
|
|
|
|
|
You asked this question yesterday and got the same answers.
You can't do it. You only option is to enumerate all the IP address on the network and ping them to test if the port is open.
As several people have said, it's like asking where to find house number 103 but without telling them which road it's on.
Simon
|
|
|
|
|
again,
1) you need to know the server ip in order to connect to it.
2) do you want to know if it´s possible for you as a client to connect to a server without giving your ip? no
When the designed application on the server asks the client´s ip when he tries to connect, if the server can´t get it, he doesn´t grant acess to the client. i woulnd´t!!!
Do you want to make a fake ip, be somewhat stealth mode? is that it? i don´t how to do that but, i think you can find something of that to download.
|
|
|
|
|
simple solution would be ...search the IP with in the LAN and match its port number.
Sr. Software Engineer
Irevna, India
|
|
|
|
|
scan the your Lan ip's using dos command " net view" it would give all machine names and then from that machine names get their corresponding ip's.
then combine ipaddress and the port u want to scan, thru this code
for (int CurrPort = 1; CurrPort <= 25; CurrPort++)
{
TcpClient TcpScan = new TcpClient();
try
{
// Try to connect
TcpScan.Connect("192.168.0.1", CurrPort);
// If there's no exception, we can say the port is open
MessageBox.Show("Port " + CurrPort + " open");
}
catch
{
// An exception occured, thus the port is probably closed
MessageBox.Show("Port " + CurrPort + " closed");
}
}
|
|
|
|
|
Hi,
I am trying to run the following code in a dynamically loaded WCF service hosted in a Windows Service.
It seems I can't load types because of the following exception:
Could not load file or assembly 'APLUGINASSEMBLY, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ddd7975916a1e051' or one of its dependencies. The system cannot find the file specified.
Here is the list of the referenced assemblies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089Viveo.Data, Version=1.4.0.0, Culture=neutral, PublicKeyToken=ddd7975916a1e051
NavigationProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullSystem.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Please note that the very same code works fine when I run the WCF Service from Visual Studio.
Thanks.
protected static void AnalysePlugins(Assembly[] Assemblies)
{
foreach (Assembly anAssembly in Assemblies)
{
try
{
foreach (Type aType in anAssembly.GetExportedTypes())
{
try
{
if (aType.GetInterface("ANINTERFACE") != null)
{
string theNavigationName = (string)aType.InvokeMember("Name", BindingFlags.GetProperty, null, aType.GetConstructor(new Type[]{}).Invoke(new object[]{}), null);
NavigationRepository[theNavigationName] = aType;
PluginRepository[aType] = anAssembly;
}
}
catch(Exception ex)
{
Trace.WriteLine(aType + " could not have its name queried");
}
}
}
catch (Exception ex)
{
System.Diagnostics.EventLog.WriteEntry("BusinessServer", ex.Message);
System.Diagnostics.EventLog.WriteEntry("BusinessServer", string.Concat(anAssembly.GetReferencedAssemblies()));
}
}
}
|
|
|
|
|
I found out!
It works when I load the assemblies using LoadFrom instead of LoadFile (it is in a function that I have not provided).
|
|
|
|
|
In my project there is a facility for user to upload images and update them later.A visitor to the site can view the users images.What I want to do is that I want to display all the images with equal dimensions.That means if the user uploads image of any size it should be displayed say as 100 X 100 without change in its quality(Resolution, aspect ratio etc.)
Any help would be highly appreciated.Thanks
|
|
|
|
|
Well, you may use GDI+ for the purpose. Look also at very nice Libor Tinka's article [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello,
I am using Thread.Sleep(1) to count down a timeout when waiting for data from a comport. I currently use 200 as my n value and this appears to cause the code below to take around 400ms on a machine with XP installed but on two other machines running Vista, it takes 3 seconds.
Is there something about Vista which causes the sleep to operate differently and is there a better technique that is recommended?
while (port.BytesToRead == 0)
{
if (--n < 1)
{
return 0;
}
Thread.Sleep(1);
}
Any help would be much appreciated!
Regards,
Christian
|
|
|
|
|
Ideally, you'd want to use a timer to time something. That way you know it will be exactly the same every time.
To achieve the same result, you could use a ManualResetEvent and a Timer like I mentioned:
ManualResetEvent wait;
Timer myTimer = new Timer(1000);
...
myTimer.Start();
wait.WaitOne();
...
void myTimerTick(...)
{
wait.Set();
myTimer.Stop();
}
The code will stop at wait.WaitOne until the timer is set off.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Hi,
While your code is a big improvement over the original one, your statement
SK Genius wrote: That way you know it will be exactly the same every time.
is overly optimistic. The delay will jitter due to timing uncertainty (see my timers
article), and of course every time you give up the CPU you are not sure to get it back
when you want it. There may be dozens of other ready threads, wanting to burn some
CPU cycles.
|
|
|
|
|
What can I say? I'm an optimistic kinda person
I suppose your right. It wouldn't be that far off though, a couple of milliseconds here, a few milliseconds there.
My current favourite word is: I'm starting to run out of fav. words!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
Thanks for the replies!! Using the ManualResetEvent and a timer was a massive improvement - 201 or 202ms normally although I soon realised, sleeping for 200ms instead of for 1ms 200 times originally would have resulted in far less context switching and greater accuracy. I will take a look at the article for more info but think that for my application, this could be good enough.
I'm still not entirely sure why Vista exaggerated this problem so much in comparison to XP but my current solution works equally well for both so I am happy.
Thanks all for your help!!
|
|
|
|
|
Could be any number of reasons. Timeslices appear machine dependent so if you were running on different physical boxes (or physical vs VM) that could be to blame. Other suspects are more background processes, or one running at a higher level when you were doing the testing, or general scheduler changes. ie if vista felt your hammering with 1s sleeps was being bad and was giving higher priority to other apps as a result.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Another impactor would be if the different machine had different CPU / core counts, or were doing "Hyperthreading".
Absolutely, time slices are non-deterministic.
|
|
|
|
|
threading is nondeterminisitic and cannot be controlled on your end. Your Thread.Sleep(1) call is telling the OS "I'm taking a break and ignore me for one 1ms". After the ms passes control does not return to your thread, instead your thread is added back to the pool of threads that the OS scheduler looks at for picking the next thread to run. Context switching is however an expensive process and normally a thread will be run a few dozen ms before the scheduler stops ti and passes control over to another thread.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Hi,
I explained these kinds of phenomena in my timer article. Have a read!
|
|
|
|
|
Hi,
The code loops through a list of machineNames and for each machinName (There are 18 of them), it loops through a number of settings (There are 39 of them).
At present I have a generic collection to populate all the settings which is called settings.
As I am looping through the settings of each machineNames, I modify the (Fields) appropriate to that MachineName in the settings loop...
In additin I also have a class which holds the fields. This is called clsSetting
This is what I have at present:
private List<DataAccess.clsSetting> settings = new List<DataAccess.clsSetting>(); //collection to hold settings...
//generic collection to hold the result
private List<List<DataAccess.clsSetting>> results = new List<List<DataAccess.clsSetting>>();
//loop through the machineName...
foreach (DataRow dr in _dtMachineNames.Rows)
{
foreach (DataAccess.clsSetting s in settings)
{
//modify these fields for the machineName in the loop...
s.Server = strServername;
s.Result = strResult
//the other fields are not modified...
}
//??????????????????????????
//This is where my question is:
//here I would like to have another collection which holds all the settings for each machineName
//something like:
results.Add(settings)
}
Question:
When I try the above code, i.e. results.Add(settings)
The results collection get added but NOT correctly.
It seems the data in it for each index gets over written because in the above code I modify some of the fields.
Can you please let me know what is wrong here?
Thanks
|
|
|
|
|
Hi,
Each time you loop through settings collection, you actually modify the original element in the settings collection. And again when you add settings to results, you actually add the same references again and again. Later changes on the original element (s) affect all the elements int the result list pointing to the same element.
So, you should create a copy from s before modifying and storing it to another collection if you want the elements to have independent values.
I think you also find several helpful articles here in CP. For example http://www.codeproject.com/KB/dotnet/Primitive_Ref_ValueTypes.aspx[^]
Mika
|
|
|
|
|
Hi...
I need to enable my Apply button only when the user edits something on the form (I have datagrids, text-, check-, comboboxes). All of them are bounded to a Databinding.
What's the best way to get this behaviour?
Life is not short... the problem is only how you organize yourself
|
|
|
|
|
With a keypress event
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I'd bind the "Enabled" property to my business object. So when value gets changed there, it gets enabled/disabled automatically. Check this[^] article.
|
|
|
|
|
In a textbox_input_textchanged event put button_apply.enable = true
|
|
|
|
|
how to Change crystal reports Runtime Location of OLE Object
|
|
|
|