|
In my office, it's possible. I just want a solution. Let me know if you have one.
|
|
|
|
|
There are a lot of things that could be in the way... can you ping between the two machines? Just having internet access isn't really enough, a lot of times certain ports are blocked off to prevent external intrusions. There could be firewalls blocking access both within the machine and externally as part of the network.
|
|
|
|
|
Look, my problem is that server program doesn’t bind to the valid IP such as 86.57.91.230. But it binds to the invalid IP such as 192.168.0.1.
|
|
|
|
|
You should let the system choose which address to bind to, rather than trying to force it. The chances are that the address you have is not the address of a network adapter on that system.
|
|
|
|
|
Is that IP address 86.57.... the IP address on your router that the outside world sees?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
|
Have you set your router up to port forward requests from the outside world to your machine? Have you open up that port on your firewall? You need to bind to your local IP address (192.168....) and have the router forward those external requests to your machine.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
Thank you so much, it worked.
Now I want to develop the program and write a program such as NETCAT. I want the victim stays at listening state after running the program.
The question is how the victim get its public IP to stays at listening state with that IP?
|
|
|
|
|
Not sure what you mean by victim, nor am I familiar with netcat. Try clarifying your question and perhaps create a new thread on this forum.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
ok. Here is about NETCAT (http://en.wikipedia.org/wiki/Netcat)
I have written a program in two client and server versions. The server program must be run on the victim computer. I’m controlling the whole of the victim computer by client program. I’ve written this program for LAN. Now I want this program works on the internet while controlling that victim computer with the server program on. The victim computer is connected to the internet by and ADSL broadband. My problem is when the server program is being run on the victim computer, how it can get the Public IP and then stays at listening state on that IP address?
|
|
|
|
|
Sounds difficult, as the ADSL router probably doesn't have a static IP address, but if it did, the server software would listen to the local machines' (private) IP address (this probably isn't static either), and the ADSL router would need to have port forwarding setup to send your server machine incoming packets. Lots of this (I'm guessing) is not done programatically. here[^] is an example of the type of setup needed.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
Dear friend, It’s not important if that public IP (ADSL IP) be static or dynamic. The code below gets public IP of that computer and it must be able bind that IP to the created socket and then stays at the listening state:
...
HINTERNET hI, hF;
DWORD piSize;
char public_ip[15];
hI= InternetOpen(NULL, INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
hF = InternetOpenUrlA(hI, "http://myip.dnsomatic.com", NULL, 0, INTERNET_FLAG_RELOAD, 0);
InternetReadFile(hF, &public_ip, sizeof(public_ip), &piSize);
public_ip[piSize] = '\0';
InternetCloseHandle(hF);
InternetCloseHandle(hI);
cout << public_ip;
...
The main problem is that my server program can’t bind to received public IP.
|
|
|
|
|
You want to bind to an IP address associated with a NIC on a seperate device (ADSL router)? If so, I don't think you can, and you don't need to (think port forwarding). If not, I'm still not sure what your question is.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
It's confusing!
Let’s imagine my public IP address is 86.57.91.237.
Now I want to use that IP in the code below:
...
WSAData ws;
struct sockaddr_in sock;
int resSock, bnd;
WSAStartup(MAKEWORD(2, 2), &ws);
resSock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (resSock != INVALID_SOCKET){
sock.sin_family = AF_INET;
sock.sin_port = htons(3377);
sock.sin_addr.S_un.S_addr = inet_addr("86.57.91.237");
}
bnd=bind(resSock, (struct sockaddr *)&sock, sizeof(sock));
if (bnd != SOCKET_ERROR)
cout << "Bind Successful" << endl;
else
cout << GetLastError() << endl;
...
why does this program show error code 10049? Error code 10049 means:
“The requested address is not valid in its context. This normally results from an attempt to bind to an address that is not valid for the local computer”.
I want to see “Bind Successful” message.
|
|
|
|
|
Run "ipconfig /all" at the command prompt. Look at the results, there should be data given about each NIC card on YOUR machine. Look at the line that says "IP Address.......xxx.xxx.xxx.xxx" (there may be several). Make a list of these IP addresses. If "86.57.91.237" is not in that list, then you can not bind to it. Meaning it is not an IP address associated with a NIC on your computer.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
Here is my Program
In the line int GCD(num1,num2) I get the warning
" warning: parameter names (without types) in function declaration [enabled by default]| "
But if I use int GCD(int a,int b) the warning is not there.
NOTE - In both cases the program runs perfectly.
I am a newbie, so I would appreciate if someone helps me regarding this....
/* I am using mingw with code blocks */
#include<math.h>
#include<stdio.h>
#include<conio.h>
int GCD(num1,num2);
main()
{
int num1,num2;
printf("\n\tEnter the two numbers whose GCD is to be found : ");
scanf("%d %d",&num1,&num2);
printf("\n\tGCD of %d & %d is %d",num1,num2,GCD(num1,num2));
getch();
}
int GCD(int a ,int b)
{
if (b>a)
return GCD(b,a);
if(b==0)
return a;
else
return GCD(b,a%b);
}
#include<math.h>
#include<stdio.h>
#include<conio.h>
int GCD(num1,num2);
main()
{
int num1,num2;
printf("\n\tEnter the two numbers whose GCD is to be found : ");
scanf("%d %d",&num1,&num2);
printf("\n\tGCD of %d & %d is %d",num1,num2,GCD(num1,num2));
getch();
}
int GCD(int a ,int b)
{
if (b>a)
return GCD(b,a);
if(b==0)
return a;
else
return GCD(b,a%b);
}
#include<math.h>
#include<stdio.h>
#include<conio.h>
int GCD(num1,num2);
main()
{
int num1,num2;
printf("\n\tEnter the two numbers whose GCD is to be found : ");
scanf("%d %d",&num1,&num2);
printf("\n\tGCD of %d & %d is %d",num1,num2,GCD(num1,num2));
getch();
}
int GCD(int a ,int b)
{
if (b>a)
return GCD(b,a);
if(b==0)
return a;
else
return GCD(b,a%b);
}
|
|
|
|
|
You should always declare the parameter types to avoid confusion.
|
|
|
|
|
So i need to specify that they are integers, right ? 
|
|
|
|
|
|
Driganka Mandal wrote: int GCD(num1,num2);
int is the default type... but that function declaration isn't exactly kosher (think it would be invalid for any C compiler, C++ compilers tend to be more forgiving but that doesn't mean it's part of the standard).
|
|
|
|
|
Quote: Is it possible of getting same answer for inverse of matrix 100*100 dimension using gsl lib and matlab
|
|
|
|
|
Of course you must get the same answer (within rounding effects), otherwise one (or both) libraries would have been broken.
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
Hi
I have old dictionary software (English-arabic) and i want to ask if there is a way to extract the dictionary data to text or excel ? just tell me how
the software coded in visual C++ 
|
|
|
|
|
It depends what you mean by 'extract'. You would need to know the structure of the data on the disk, and design a structure for the system you want to store it on. The issue is a matter of design rather than programming.
|
|
|
|
|
Could you please tell me how to get Google's PageRank for a desired web page using C++ language? Thank you!
|
|
|
|