|
I really dont know networking.
Why every LinkSYs router has such IP:
192.168.1.1.
I am confused, if router has this IP, how can an packet know where to go?
I know this must be a stupid question....Dont laught at me
|
|
|
|
|
This is not a C# question...
But I will supply you with an answer : the router usualy gets the IP addres 192.168.1.1. Why this addres? Maybe because this is an easy-to-remember addres. Anyway,I know thatthe addrescan be changed.
A packet travels through the internet with the help of gateways. A gateway routes the pachet to the requested destination.
This is exactly what a router does : it has 2 port types - LAN and WAN. It routes the pachets from the lan to the wan and viceversa, it acts like a gateway at a specified addres.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
192.168.1.1 is the first IP address in a class C private network. Read this RFC for more information about private networks: http://www.ietf.org/rfc/rfc1918.txt[^]
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
LinkSys routers have 192.168.1.1 as an ipaddress because
LinkSys assumes you will be communicating on this already configured subnet.
Subnet address --> (192.168.1) Host --> .1
Note:
The .1 in the ipaddress represents the router, 192.168.1 represents the subnet.
I wont mention the subnet Mask, this only will confuse you further, you must first understand the basics.
For example if you are at home and use DSL or Cable for internet access.
You have a modem which connects to your LinkSys router. Your router actually has 2 IP addresses
69.254.36.244 or whatever for your external (public, internet, WAN) address and 192.168.1.1 for your internal (private, LAN) address.
If your router is configured as a DHCP server (The duty of passing out ipaddresses to anyone on your private network) Then every computer connected on your LAN or private network will receive an ipaddress on the 192.168.1 subnet from your router.
So whenever you connect your computer to your linksys router you will receive an ipadress between
192.168.1.2 - 192.168.1.254 - remember 192.168.1.1 is used for your router so u cant use that one.
Hope this helps
If a router has that particular ip (192.168.1.1) then how does it no where to send packets???
Easy!!!
The packet will either have an IP address on the subnet configured by your router (192.168.1)
or some other IP address not on your private Network!!!
If the packet has an ipaddress on the 192.168.1 network (subnet) it's communicating on the LAN so it will send the packet to another computer on the subnet.
If it has a weird 68.126.88.92 ip address on the packet then it will send the packet out to the external IP address - Then your packet will be in the hands of an ISP router.
Then that router looks to see if it has the direct destination of the packet on its network if it doesnt This router also has another ip address so it sends the packet away to another router and so on and so on until it finally reaches its destination!!!
-- modified at 18:13 Friday 10th February, 2006
|
|
|
|
|
OK, i'm building an application where a user will be required to enter customer data which will later be stored in a database.
As an example, the user may have to enter the customers email address into a text box.
Now obviously, there has to be some kind of validation between the data being entered in the UI and stored in the database not only to avoid sql injection but also to check the format etc.
My question is where the validation should occur?
Should there be an emailAddress object which performs such validation?
It doesn't seem the right approach to attach all the validation to the UI.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
You didn't specify whether this was a web app or a winforms app. The answer is different depending on that. In a web application, the answer is it should be done on both the UI *and* on the server side. This is because it is possible to circumvent form controls by writing automation scripts that ignore UI validation. You should be validating on both ends--on the client side to provide quick feedback to the user without a round-trip to the server, and on the back end in case something slipped past the client validation.
If, however, you are building a winforms application, it depends on how much detail you give to your design. Good multi-tier design might have you place validation in a business rule, however, there is virtually no danger that the user will hijack the request in a winforms app which means you could validate once on the control and not have to worry about getting bad data.
Anyhow, a google search will provide you with a lot of information on how to validate user data using C#.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Initially, the app will be winforms based with a view to adding a web based customer portal further into the project.
My reason for asking these questions now is an attempt to avoid hard coding potential problems into the design but I also have a desire to keep this as simple as possible.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
Items like this don't, in my experience, create major design issues. Larger business rules such as (and I'm making this up) "Child record can only be entered if Parent record field 'hasChild' is checked" tend to be what cause more problems from a design perspective if you hard code them. You might later decide you want to determine whether a parent has a child based on whether or not there are actually any child records related to a parent record, so such a validation would be done more at the database level (I hope I'm not being to obscure here).
Simple "sanity checking", so to speak, won't create major design flaws that will cause you to have to start over. You might have to tweak the patterns you are using, but there is not a lot of danger in doing so and will in all liklihood be necessary. In practice I almost always just add the basic validation to both the client and server (or just the form in winforms) without providing some larger design structure for it. That's me though. I'm sure there are other opinions.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
i am trying to build a "missed message" queue on a C# TCP server. many
of the devices connecting are mobile and may drop out in bad signal
areas. i want to store any messages missed for when they reconnect.
so far....it takes activity on the client end to initialize the close.
isnt there a check when the server sends a socket.send to a client that
has lost connection? it takes a few minutes for the exception to get
hit, and i am losing vital time.
is there a way for as soon as the the server attempts Socket.Send it
can tell if the device on the other end still has an active connection?
even Socket.Poll() has quite a delay.
i have been testing with desktops. I connect two workstations to the
server and when i chat back and forth, i unplug one from the network.
it takes at least two minutes for the server to recognize that one
client is disconnected while the still-connected client is sending
messages. it seems they are just going nowhere.
|
|
|
|
|
How about using UDP in some way?, it is a connectionless protocol.
Packages like Symantec pcAnywhere (a remote control/file transfer application) use UDP to moniter the status between connections and TCP for data transfer.
Or alternatively, how about the clients collecting/pulling the messages from the server instead of them being sent/pushed to the client?
Just some ideas.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
i thought UDP doesn't have verification of message arrival. it just sends blindly, right?
the problem with the client pull is that in my scenario, the clients are passive, the server handles all activity...sometimes automatically based on outside forces.
|
|
|
|
|
<quote>it just sends blindly, right?
Yes, thats right. What I was thinking was perhaps the Client could send a UDP datagram to the Server at regular intervals. The Server could listen for the datagram, rather like pinging the server. The server need not send a reply to the client but upon receiving the request, it knows the client is still active.
It could keep the connection alive.
I guess however, it depends on how passive the clients are?
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
okay, i'm kind-a new in here, but i have a problem.
the problem is in my webservice, but this is in C#, and the problem is more C# related.
the code below is the code i use, it always return false through the Catch, the Catch sais "No Value given for one or more..." (well i hope you know this exception).
the problem i can't figure out, is why?
if someone can help me i would be very thankful.
yours, NaNg.
<br />
[WebMethod]<br />
public bool AddProject(string ProjName, string ProjID)<br />
{<br />
try<br />
{<br />
objCon.Open();<br />
DataSet ds = new DataSet();<br />
objDA = new OleDbDataAdapter(string.Format("Select Count([SID]) from tblProjects Where SPorjID = '{0}' And SProjName = '{1}'", ProjID, ProjName), objCon);<br />
objDA.Fill(ds, "tblProjects");<br />
if ((int)ds.Tables[0].Rows[0][0] == 0)<br />
{<br />
objCmd = new OleDbCommand(string.Format("Insert into tblProjects(SProjID, SProjName) Values('{0}', '{1}')", ProjID, ProjName), objCon);<br />
objCmd.ExecuteNonQuery();<br />
return true;<br />
}<br />
else<br />
return false;<br />
}<br />
catch (Exception exp)<br />
{<br />
return false;<br />
}<br />
finally<br />
{<br />
objCon.Close();<br />
}<br />
}<br />
|
|
|
|
|
NaNg15241 wrote: the Catch sais "No Value given for one or more..." (well i hope you know this exception).
Um, no. This is pretty much the crux of your problem. You need to provide the complete text of the exception for anyone to be able to help you?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi,
I am encountering problems with clearing the combobox, the first value gets automatically selected. Even though i have set the SelectedIndex to -1 in the load event.
Another problem: I have placed the combobox on a tabpage of a tabcontrol. If I clear the combobox and then swtich tabs the first value again gets automatically selected.
The combobox is bound to string array.
Using .NET v1
It seems like a .NET bug to me. Any help would be appreciated.
Thanks.
|
|
|
|
|
If you haven't already created one, add an event handler to the combobox for SelectedIndexChanged. Then add some dummy code at the beginning of that method and place a break point on the dummy code. Then, when the index changes, the break point will be hit and you can track where it was called from.
Hope that helps.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I am failing in finding a way to use the new ListView.OwnerDraw=true and render a custom background.
- ListView.BackgroundImage does not work for our needs.
- SetStyle(ControlStyles.UserPaint, true); causes OnPaint and OnPaintBackground to fire *after* OnDrawItem, erasing any custom Item rendering.
Am I missing a way to custom draw a ListView background while using the new-fangled OwnerDraw?
|
|
|
|
|
Q. Unable to get a Profile custom (object) collection to bind to GridView,etc (IList objects)?
This is my first custom object so I may be doing something rather simple, wrong, or it may be something else to do with the Profile object. Either way, I need help
Here's a brief description of the code----------------------------------------------------------------------------------
1) I have a custom object: "School.Teachers" (see below)
2) which is used as a Profile object data type in the web.config file:
<profile defaultProvider="AspNetSqlProfileProvider" >
<properties>
<add name="Teachers"
type="School.Teachers"
allowAnonymous="true"/>
</properties>
</profile>
3) I'm setting the value of a Profile object (ASP.NET 2.0) equal to the custom object:
School.Teachers tlTeachers = new School.Teachers();
tlTeachers.Add(new School.Teacher("Buck"));
Profile.Teachers = tlTeachers;
4) Code like this works:
Label1.Text = Profile.Teachers.Count.ToString(); // The number of items in the profile object
Label1.Text = Profile.Teachers[1].FirstName.ToString(); // The value of an item at a particular index position
5) But this does not:
GridView1.DataSource = Profile["Teachers"]; // Populate the GridView1 from the Profile Object
GridView1.DataBind();
The custom object: "School.Teachers"---------------------------------------------
[Serializable()]
public class Teachers : CollectionBase
{
public Teachers()
{}
public Teacher this[int index]
{
set
{
List[index] = value;
}
get
{
return (Teacher)List[index];
}
}
public int Add(Teacher value)
{
return List.Add(value);
}
public int IndexOf(Teacher value)
{
return List.IndexOf(value);
}
public void Insert(int index, Teacher value)
{
List.Insert(index, value);
}
public void Remove(Teacher value)
{
List.Remove(value);
}
public bool Contains(Teacher value)
{
return List.Contains(value);
}
}
-- modified at 14:35 Friday 10th February, 2006
|
|
|
|
|
Hello,
I have textbox.text = row["TotalArea"].ToString();
In VS 2003, all the trailing zeros were removed, so if the value of the area was 60.0000, then I would see only the value of 60.
However, in VS 2005 the same statement gives 60.0000. Exact value from a server. How can I make sure for all values the zeros are removed.
Thank you.
|
|
|
|
|
Specify the format string you want to use in the .ToString() method.
TextBox.Text = row["TotalArea"].ToString("###.##");
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
But that way if the value has 3 decimal values, it will cut it short.
So I guess what I am asking, how come the same command produces different results in both version of Visual Studio?
|
|
|
|
|
Actually, I'm not getting the results your describing. No matter what I input for a datatype, I'm always getting the trailing zero's removed when .ToString() returns.
You might want to try to force the value to a known type first before calling ToString() on it:
textbox.text = ((float)row["TotalArea"]).ToString();
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is there some documentation of all available formatting rules? In my opinion MSDN lacks this information, but maybe I'm just blind
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Do you mean this[^]?
Be sure to look at the index on the left side of the page to see additional information. Formatting is a MUCH larger topic than it would appear to be.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That's a great source, thanks
modified 12-Sep-18 21:01pm.
|
|
|
|