|
I'm having alittle trouble with the SOCKS5 protocol. Maybe someone here can help.
http://www.rfc-editor.org/rfc/rfc1928.txt
the initial request consist of 3 bytes
request[0] = 0x05;
request[1] = 0x01;
request[2] = 0x00;
the response contains 2 bytes
response[0] == 0x05;
response[1] == 0x00;
the next request is 10 bytes
request[0] = 0x05;
request[1] = 0x03;
request[2] = 0x00;
request[3] = 0x01;
(destination IP).GetAddressBytes().CopyTo(request, 4);
int byte1 = (destination Port) / 256;
int byte2 = (destination Port) % 256;
request[8] = (byte)byte1;
request[9] = (byte)byte2;
now this is where im having trouble. with the next response. the first 4 bytes are fine
response[0] == 0x05;
response[1] == 0x00;
response[2] == 0x00;
response[3] == 0x01;
but with the next 4 bytes its supposed to return an IP address to which im supposed to send udp data to. the bound address, but it returns an ip of 0.0.0.0. then the next two bytes are fine which is the bound port to send the udp data to. now why would it be returning a null ip? am I just suppsoed to use the proxy IP when it comes to UDP?
modified on Sunday, October 11, 2009 4:11 AM
|
|
|
|
|
|
I working on application in which i need to log urls browsed in internet explorer. For this up till now i am using low level key hook to trigger application to copy address bar content i.e. user have to press 'c' to log the url.
But i need to automate this part such that when ever there is change in url at address bar, trigger is generated to copy it to log file.I need some pointer for this task.
language preference is c# as i need to integrate it in latter dev stage.
|
|
|
|
|
I'm trying to get my PropertyGrid to refresh when the control in the designer has finished resizing, i'm not exactly sure on how to do this. Is there a way to get it to update on a value change as i'd rather not have to pass a reference of the property grid to the control being resized in order to refresh the values.
I'm not sure if i explained that to well
|
|
|
|
|
Most controls hanve a OnResize event, if not you will need to search the event list and choose one. Either refresh the property grid in that event or have the property grid subscribe to the controls event.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
To clarify things. Is the PropertyGrid you talk about the one in the Visual Studio IDE, or one you have put on your form?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
How can I make it stop doing that?
I've been googling for hours, but they always say there is no solution.
Manually playing with GetFocus and SetFocus didn't even work, but it could be that I did something wrong there
|
|
|
|
|
This may sound like a silly question, but what is your tab order?
The lowest number control gets the focus on form load - I just tried it with a label, textbox, webbrowser and button, created in that order and the textbox got the focus as I expected.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Oh it's much worse than that, it doesn't even steal the "local focus" but it causes the entire window to steal focus (even though I disabled focus stealing with the TweakUI!)
|
|
|
|
|
Oo! Thats nasty!
Have you tried any of the webbrowser replacement controls?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Ah no, I couldn't find any
Are there any you would recommend?
|
|
|
|
|
I haven't tried any, but a quick google for "webbrowser control replacement" gave >1M hits. It's possible one of them might work. Good luck!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Most of them are just new wrappers around the old ActiveX control and thus have the same problem
|
|
|
|
|
Alright I'm just going to do it the hard way, HttpWebRequest s
|
|
|
|
|
I have started to make a basic generic list tree how ever when it comes to adding a parent that has more than one node I have realised that i need to some how dynamicly add loops to i can display the details from "n" number of nodes attached, of course this is a silly idea so i need some help on finding a more feasible solution, can any body help me?
This is my source :
class Program
{
static void Main(string[] args)
{
CsTree tree = new CsTree();
tree.AddNode(new CsNode<CsBox>(new CsBox(1,2,4,8)));
tree.NodeList[0].AddChild(new CsBox(100,200,400,800));
tree.NodeList[0].AddChild(new CsBox(2, 3, 4, 5));
tree.AddNode(new CsNode<CsBox>(new CsBox(1, 1, 1, 1)));
tree.NodeList[0].NodeMembersList[0].AddChild(new CsBox(2, 2, 2, 2));
tree.DisplayAllNodeData();
tree.NodeList[0].NodeMembersList[0].NodeMembersList[0].NodeData.DisplayDetails();
Console.ReadKey();
}
}
class CsNode<T>
{
public T NodeData;
public Dictionary<int, CsNode<T>> NodeMembersList = new Dictionary<int, CsNode<T>>();
public int NodeMemberCount = 0;
public CsNode(T nodeData)
{
NodeData = nodeData;
}
public void AddChild(T childData)
{
NodeMembersList.Add(NodeMemberCount, new CsNode<T>(childData));
NodeMemberCount++;
}
}
class CsTree
{
public Dictionary<int, CsNode<CsBox>> NodeList = new Dictionary<int, CsNode<CsBox>>();
public int TotalNodes = 0;
public void AddNode(CsNode<CsBox> node)
{
NodeList.Add(TotalNodes, node);
TotalNodes++;
}
public void DisplayAllNodeData()
{
for (int i = 0; i < TotalNodes;i++ )
{
NodeList[i].NodeData.DisplayDetails();
for (int k = 0; k < NodeList[i].NodeMemberCount; k++)
{
NodeList[i].NodeMembersList[k].NodeData.DisplayDetails();
}
}
}
}
class CsBox
{
public int X;
public int Y;
public int Width;
public int Height;
public CsBox(int x,int y,int width,int height)
{
X = x;
Y = y;
Width = width;
Height = height;
}
public void DisplayDetails()
{
Console.WriteLine("X {0} Y {1} Width {2} Height {3}",X,Y,Width,Height);
}
}
So far i have managed to get it to display the details of The Base node, and its child nodes attached, i want it so i can display an unknown number of nodes attached to the child nodes if any, ie Base- Child - node - node ect instead of just Base - Child
|
|
|
|
|
I presume there is a valid reason not to use a standard treeview or one of the many commercial controls. Infragistics does one with an outlookexpress style which combines a treeview and a listview. There is an excellent one here that is also opensource A Much Easier to Use ListView[^]
If you insist on rolling your own (not a bad thing) then you need to understan recursive structures, you need 2 methods. This assumes there is a heirarchical relationship in your collection.
LoadBaseNodes(Trreeview, Collection)
Create the top level of nodes into the treeview
Call LoadeSubNodes(ThisNode, Collection)
Add node to treeview
LoadeSubNodes(ThisNode, Collection)
Create the nodes that are children of ThisNode
Add nodes to ThisNode
Call LoadeSubNodes(ThisNode, Collection) <= this is recursive (calls itself)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for that i will see if i can implement it :P
I primarily wanted to make one to make a quad-tree for a mass collision simulation, so its not visual
|
|
|
|
|
|
Thank you both for your help, the second post from "Nick B" was quite helpful, I am only a student so I don't expect much but you two have surpassed , thanks again!
|
|
|
|
|
If I set the paper size of the dialog to "US Index Card 5x8" (one of the options in the Page Size dropdown list), then open the dialog, "Letter" is selected for the Page Size. See code below:
pageSetupDialog = new PageSetupDialog();
pageSetupDialog.Document = new PrintDocument();
pageSetupDialog.PageSettings.PaperSize = new PaperSize("US Index Card 5x8", 500, 800);
DialogResult result = pageSetupDialog.ShowDialog();
Even if I select "Letter" or "Legal" in the dialog box and click OK, pageSetupDialog.PageSettings.PaperSize is still set to the custom size, NOT Letter as it should be.
Is this a bug? Please help.
|
|
|
|
|
Hi,
I am using the following code for testing purposes:
public class VariousTests
{
public static void Main(string[] args)
{
AClass c = new AClass();
int y = c.DemandSupplyMatrix[0, 0];
}
}
class AClass
{
private int[,] _aMatrix = null;
public int[,] DemandSupplyMatrix
{
get
{
if (_aMatrix == null)
_aMatrix = new int[9, 4];
return _aMatrix;
}
}
}
I run it until I hit breakpoint 2 and I expect to see DemandSupplyMatrix being null in the debugger. Instead, it appears to have been already instantiated, and I have never hit breakpoint 1...
I really need to debug the getter but it seems that I have no chance.
Is this normal or am I missing something?
Bogdan.
|
|
|
|
|
Hi,
I tried this on VS 2008 C# Express, and you're right, breakpoints inside getters never get hit.
If you turn the getter into a normal method, it works fine.
Probably is a bug in VS, properties get translated in methods with a slightly different name...
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
It is also the suggestion of MS FxCop. Never use an array directly in a property. The suggestion is always change it to a method.
|
|
|
|
|
I was very surprised to see breakpoints work fine when the getter properties return a simple variable or a collection such as a List<int>, and they don't when the return type is an array. That doesn't make much sense to me.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
hi, currently working on an internet cafe software which will be in client/server structure.Client and server will communicate in both ways(customers give orders from clients and server controls computers) and I am planning to use TCP sockets. So am I on the right direction? or what would be the best way? thanks in advance
a fast and stable connection type and your valuable comments would be nice
|
|
|
|