|
Nish [BusterBoy] wrote:
Yes, that's what I mean
then I can tell you: It works!
So if I do this, nobody could connect to the server... cool!! Thank you for all other topics!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Rickard Andersson wrote:
then I can tell you: It works!
Cool!
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Looks good
Just in case your interested, here is a snippet of an old perl code.
It was an http deamon used as chat server, which can block unwanted IPs. Default setting below is allowing all incoming clients. I think you can imagine how to limit on only LAN IPs.
<br />
# AccessList: Define the access permitted list of IP's <br />
# (use komma as seperator).<br />
AccessList = *.*.*.*<br />
<br />
# DenyLis: Define the noaccess list, any IP matching a member of this<br />
# list will be denied access. The denylist is searched after the<br />
# accesslist (look above).<br />
DenyList = <br />
{
...
# Check to see if caller can access the server, if not kick him
if(!&CheckAccess($ENV{REMOTE_ADDR},@AccessList)) {
&ErrorMessage(*NS,$inp,403,"Access Denied"); exit 0
}
# Check to see if the caller is explicitly denied access to the server
if(&CheckAccess($ENV{REMOTE_ADDR},@DenyList)) {
&ErrorMessage(*NS,$inp,403,"Access Denied"); exit 0
}
...
}
# Test client IP against access lists, returns true if match
sub CheckAccess {
my ($who,@list) = @_;
my $pattern;
foreach $pattern (@list) {
$pattern =~ s/\./\\./g ; #replace . by \.
$pattern =~ s/\*/\\d\+/g; #replace * by \d+
return 1 if $who =~ /$pattern/;
}
return 0; #search failed
}
|
|
|
|
|
Nish and Rechard,
Thanks a lot! I want to know it is possible or not
to insert and eject cd-rom door by using Scsi command,
such as, sendaspi32command. If the the cd-rom is a local
one, it is not needed for considering the IP address. If it
is a intenet cdrom, i will try to the ones your provided.
Best Regards,
chen
|
|
|
|
|
Is it possible to retrieve all clients IP in my LAN in my program??
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
http://www.codeproject.com/treectrl/networktreectrl.asp
Article by Paolo Messina.
-Gile
|
|
|
|
|
Thanks!
I will post a message if I have problems!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
I'm curious if it helped? I would try to make a UDP broadcast into the LAN and let my clients answer on it with a short "hello i'm here".
|
|
|
|
|
Well... I have checked the code now and don't see anything that can give me the IPs...
Moak.. do you know how to do that?!
Sample code maybe!?
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Hej Rickard,
have a look into the winsock FAQ, there should be an example with UDP programming. Basically you send out a short UDP package ("ping") to everyone in the LAN (broadcast), your clients listen to it and answer with another package telling that they are alive and understand your protocol ("pong"). So you will get and collect the "pongs" and get IPs of all alive clients in the LAN. Unfortunately, UDP broadcasts will be usually filtered out on routers (at least from your ISP for heaven's sake), so maybe you will only reach client in the current LAN interface. Just give it a try.
If you need a "deep LAN broadcast" try multicast (much more modern than UDP broadcast AFAIK) or setup a central directory server or a kind of superpeer where all clients register, then you get all clients IPs in the LAN. Actually I prefer the true P2P decentralized solution, but that is your decision.
Code, sorry Im not far now still working on my GUI (again), in a few week I will hopefully find time to do UDP too. Mee me on IRC
/Moak
|
|
|
|
|
Moak
Why not sign in on CodeProject!?
Thanks for your help! I will look up some more info about that now! (Danke! )
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Hi,
How to use the function SetDlgMsgResult ?
The follows are an example, but I can't understand their meaning,
#define adgHANDLE_DLGMSG(hwnd, message, fn)
case (message): return (SetDlgMsgResult(hwnd, uMsg,
HANDLE_##message((hwnd), (wParam), (lParam), (fn))))
Jeffrey Richter said:
The normal HANDLE_MSG macro in WINDOWSX.H does not work properly for dialog boxes because DlgProc's return a BOOL instead of an LRESULT (like
WndProcs). This adgHANDLE_DLGMSG macro corrects the problem.
My Question is, the parameter list in SetDlgMsgResult(HWND hwnd, int msg, LONG result) puzzles me. Which parameter replaces which parameter, and where does this action take place, in memory of window?
Thank you.
Best regard.
One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
There is no API or MFC call named SetDlgMsgResult. SetDlgMsgResult seems to be one of Richter's custom functions too
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
Nish [BusterBoy] wrote:
There is no API or MFC call named SetDlgMsgResult. SetDlgMsgResult seems to be one of Richter's custom functions too
Following words are copied from MSDN. I have to declare that I've installed SDK in my system.
SetDlgMsgResult
This macro maps to the SetWindowLong function.
SetDlgMsgResult (
HWND hwnd,
int msg,
LONG result );
Parameters
hwnd: Handle to the dialog box.
msg:Specifies the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus four.
result:Specifies the replacement value.
In my point of view, the value of parameter result is used to set the parameter msg. But set value in this way(set to an zero-based offset) is strange to me. I want thorough understanding of this function.
Thank you,
Best regard.
One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
Oh sorry!
My MSDN must be really old
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
I have checked the preface of this book. It's named Window95, a developer's guide written by Jeffrey before 1997. It's a Win32 SDK programming guide which includes several key techniques such as subclassing and superclassing, hooking etc.
Best regard.
One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
Thanks for the info Nicholas
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Include htm, html, css, asp and so on.
thank you very much.
zl
|
|
|
|
|
|
One node at a time, probably recursively.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
So Christian, I will have to write it? There is nothing that can do the job in MSXML; give it two XML structures and to compare them. Any idea?
Thank you
Vance
|
|
|
|
|
If you are not a .NET or VB hater, here is how:
dim doc1 as XmlDocument = new XmlDocument()
dim doc2 as XmlDocument = new XmlDocument()
doc1.LoadXml("file1.xml")
doc2.LoadXml("file2.xml")
if doc1.OuterXml = doc2.OuterXml then
' the same
else
' different
end if
|
|
|
|
|
What about if the nodes are out of order, or white space
|
|
|
|
|
Ok, you need to state clearly what you mean by "compare"?
1. Do you want to check if the two files are exactly the same? You don't need XML to do that.
2. Do you want to see if the two files will generate exactly the same XML document? My sample does that.
3. Do you want to check if the two files have the same set of nodes but may be in different order, and each node may have the same number of children but may be in different order? What about attributes, you want to compare that too?
4. ...?
So what is it that you want?
|
|
|
|
|
Number 3 is what I am looking for to solve...
|
|
|
|