|
Okay but i tried many sample socket program it's works fine within a network ips like 127.0.0.1 but i tried to connect dynamic ip( which is get for www.whatismyip.com) it's fails to communicate..
|
|
|
|
|
ravijmca wrote: but i tried to connect dynamic ip( which is get for www.whatismyip.com) it's fails to communicate..
To use IP there are two computers: client and server.
To use IP there MUST be a way to route between those two computers.
To route the address of the server must be exposed to the client. There are ONLY two ways to do that on the internet.
1. The server MUST have a public IP.
2. The server MUST have a network setup (routers/gateways) such that a public IP will route to the server (the server need not have a public IP.)
whatismyip will always give a result but that result doesn't mean anything. All that matters is 1/2 above.
For normal ISPs there are three ways that they provide customers with "internet".
1. The customer has a static public IP.
2. The customer has a dynamic public IP.
3. The customer does not have a public IP. (in this case it does not matter whether it is static/dynamic.)
The result of whatismyip is only relevant to the above if the ISP is 1 or 2. If that is the case then the IP listed is the one that your computer (or router/modem) has.
Note that 127.0.0.1 is not a public IP nor is it a private one for that matter. (Also just because your computer has a public IP it doesn't mean it is public on the internet but it does make it more likely.)
|
|
|
|
|
You forgot to mention the added interference of firewalls into the whole equation.
|
|
|
|
|
anybody can help me...
i have a problem, how to make a file transfer UDP client-server by giving 1 bit error in the file being sent?
|
|
|
|
|
Your question is a bit unspecific. What do you have trouble with? UDP? Using the parity bit thing? Reading a file? What did you try until now?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
|
Why UDP?
UDP does not offer reliability. But In case of file transfer reliability is important.
Are you sure its UDP? not TCP?
|
|
|
|
|
yeah,UDP
I want to create a program that can send the file. but when the file is received the client, a large bit of data is not the same. then resend the request until the server successfully.
if you have the source code in c?
for my coursework ...thank's
|
|
|
|
|
Brillian Kharisma wrote: you have the source code in c? for my coursework
All the more reason for you to do it yourself. Ask us specific questions about specific code problems to help you. No one here is going to do it for you.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
UDP is NOT typically used for file transfers because it's not reliable. If you add parity, you can detect errors and request resends, but you're just replicating TCP at that point.
Brillian Kharisma wrote: if you have the source code in c?
for my coursework ...thank's
You need to do your own homework. Sorry.
|
|
|
|
|
The only advantage you gain from UDP is speed. I use UDP for realtime hardware status updates but I never use it to transfer files. Why not use TCP as others have suggested. It was designed for streaming files. You could also check out named pipes.
|
|
|
|
|
I want to get two front and profile picture of a person then make 3D Head model of it using Visual C++ and openGL.
How could I start?
|
|
|
|
|
Look Creating 3D Head model open GL C++here[^]
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
|
Hello everyone!
I have a EasyN ip Camera and I want to take the picture as .Jpg. The url that displays the image in my browser is http://192.168.1.xxx:xx/videostream.cgi.
After many hours searching in the internet I found this interest tutorial Camera Vision - video surveillance on C#,
but because I do not know much about Visual Studio did not help me very much.
Specifically, I have created a Visual C # Console Application but when I try to debugging shows some errors like: "The type or name 'HttpWebRequest' could not be found (are you missing a using directive or an assembly reference?)".
What am I doing wrong and the program not works?
Initially, What I want is the picture is automatically saved in my hard disk as .Jpg format. How can this happen?
Here is my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
string sourceURL = "http://192.168.1.xxx:xx/videostream.cgi";
byte[] buffer = new byte[100000];
int read, total = 0;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sourceURL);
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
while ((read = stream.Read(buffer, total, 1000)) != 0)
{
total += read;
}
Bitmap bmp = (Bitmap)Bitmap.FromStream(
new MemoryStream(buffer, 0, total));
}
}
}
It would be valuable any of yours help!
Thank you!
|
|
|
|
|
Your first problem is that you have posted this in the C++ forum rather than the C#[^] one. However the error message means that a reference is missing from your project.
[edit]Right click with your mouse on the References section of Project explorer and select "Add Reference ...", then find the assembly named "System" in the .NET section, and add it to your project.
You will also need to add the following statement to the top of your source code:
using System.Net;
[/edit]
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks for your answer! I apologize for my mistake ...
I've done all everything you said and actually decrease errors. However there are still 5 errors relating some wrong commands. For example, some of errors are:
"The type or name 'Stream' could not be found (are you missing a using directive or an assembly reference?)"
"The type or name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?)"
"The type or name 'MemoryStream' could not be found (are you missing a using directive or an assembly reference?)"
Do you know how experiencing this error?
|
|
|
|
|
Eventually was missing the command using System.IO;
So the following 2 errors are gone
"The type or name 'Stream' could not be found (are you missing a using directive or an assembly reference?)".
"The type or name 'MemoryStream' could not be found (are you missing a using directive or an assembly reference?)".
Now the problem is with the command Bitmap
|
|
|
|
|
Synodiporos wrote: Now the problem is with the command Bitmap
All of these classes are described in MSDN. Here is the link to Bitmap [^]; the others are easy to find.
And, more usefully, MSDN comes in many languages other than American.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks for your advice Richard!
I have fix all the mistakes and now the program is running. The problem now is that i take a warning in this line:
while ((read = stream.Read(buffer, total, 1000)) != 0)
The warning says “Specified argument was out of the range of valid values.
Parameter name: size”
I changed the size of the variable to a larger but the problem remains. I do not know what else should I do now ...
|
|
|
|
|
Forget it! Once I found a solution for this ...
int bytesToRead = 1000;
while ((read = stream.Read(buffer, total, bytesToRead)) != 0)
{
total += read;
bytesToRead -= read;
}
Perhaps the variable "bytesToRead" should be reduced in the loop ...
|
|
|
|
|
I am coming again to the thread to asked you a little help.
I have make all necessary changes and now my program is running without any errors or warnings. But i can not see the image! Specifically I created a form with a button and a pictureBox. I want when I click the button to save the image and display it in the pictureBox.
Why cannot display the image? Here is my example:
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string sourceURL = "http://192.168.1.xxx:xx/videostream.cgi";
byte[] buffer = new byte[200000];
int read, total = 0;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(sourceURL);
req.Credentials = new NetworkCredential("Admin", "xxxx");
WebResponse resp = req.GetResponse();
Stream stream = resp.GetResponseStream();
int bytesToRead = 1000;
while ((read = stream.Read(buffer, total, bytesToRead)) != 0)
{
total += read;
bytesToRead -= read;
}
Bitmap bmp = (Bitmap)Bitmap.FromStream(stream);
bmp.Save("C:\\image.jpg");
pictureBox1.Image = bmp;
}
private void pictureBox1_Click(object sender, EventArgs e)
{
}
Can you help me in this?
|
|
|
|
|
What type of object is pictureBox1 and are you sure that the statement
pictureBox1.Image = bmp; sets the object correctly? Note that the bmp object gets destroyed as soon as the button1_Click() function terminates.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks for your help!
Now, I can get the image from the camera ...
|
|
|
|
|
While it's not a solution to your question, I'd like to point something out.
Any network address that begins with 192.168 is an address in a private network. What this means is that, only computers in that network may access other devices within it.
As such, it's entirely safe for me to say that the IP of the machine I'm typing on right now is 192.168.43.156 , and that the address of my gateway (the 'side' of the router that my pc can see) is 192.168.43.1
If I browse to a 'WhatsMyIp' type of website, the address returned is the IP that the 'other side' of my router has - the address that CAN be seen from anyone connected to the web. This address is NOT safe to share publicly.
See here for more on private networks: http://en.wikipedia.org/wiki/Private_network[^]
|
|
|
|