Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I created a simple TCP/IP server in c and it runs smoothly from my Linux machine. I can connect as localhost:80 as well as from different machines, but I obviously have to use the lab computer's IP.
My question is: how do I run a server form my own Mac OS X machine, let's say, and connect to it form outside? Not sure how to properly ask the question... how to assign a specific IP to my server? Sorry, I am still exploring this field!
Thanks!
If your local proxy or box is configured to allow entering connections, the easiest is to assign a fixed name that will be mapped to your (dynamic) IP.
There are a lot of dynamic DNS free solutions on the web (ex : http://www.no-ip.com/)
If you just want to make a one time test, you can see what IP you have with a service like this one : http://www.whatismyip.com/
All you need is a machine that has globally routable static ip address. And run your server on that machine.
Running it on your Mac laptop is okay but as you hop from one wifi network to other your server is no longer available.
Best way is to find a machine , a desktop in your lab or ar home connected to say comcast isp that has a static globally rout able ip and run your server on there.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to use the c-programming language to built a small database for students. Only the admnistrator should enter delete or modify the data. I have developed this program in C. But when i close my program, the data is lost. At the beginning i thought to store these data in files (like xml) but know i thinking to store these data on hardware (harddisk or sd-card). Is it possible? Any suggestions?
You could write a separate program which acts as a "server" - that is, it runs continuously and communicates only through some sort of network interface - named pipes or TCP/IP or whatever. When your "client" program starts up it attempts to establish a connection with the server - if it does not find the server it starts it up and then establishes communications with it. Once the "server" is found the "client" requests any saved data from the "server", which the "server" then returns if it has any. When the "client" decides to shut down it first communicates with the "server", passing any data it wishes to save to the "server" which then stores it (perhaps in a file, perhaps in memory - the implementation is up to you).
Best of luck.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I am experimenting reading (and eventually writing) serial ports in C. I want to be able to connect to a port on debian and read in some data but I need a port that is writing (speaking). I am new to linux programming.
What port, that will definitely be present and talking in debian, can I connect to to read some data in?
Can you also suggest a port I can eventually use to write to aswell?
I've tried connecting to /dev/ttyUSB1 that this example uses but that port doesn't exist.
I would suggest either open /dev/random (or /dev/urandom) as Paul suggests or create your own socket and read/write to that. Don't just pick an arbitrary socket and hope it has information that no other process needed.
If this is your first time working with sockets I would also suggest that you try playing around with things in a language like python simply because you don't need to recompile to see where you went wrong and the warnings are often more readable (take a look at https://docs.python.org/2/howto/sockets.html)
As a side note: If you have access to an arduino you might like to try connecting to that socket (usually something like ser = serial.Serial('/dev/ttyACM0', 9600) in python).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Here is my configuration
my PC IP :192.168.1.57 subnetmask : 255.255.255.0
my device IP :73.83.1.57 subnetmask : 255.255.255.0
i am successfully able to send packet from my pc to device but not able to send packet from device to pc (have checked in wire shark but it show only PC->device packet transmission flow )
Now i have added one more IP like device ip family in PC (73.83.1.60) then successfully able to two way communication.same works in reverse order means i have set my device IP as 192.168.1.58.
So is there any rules like both IP must belongs to same IP family?
because sub net mask in both are same. so issue is IP.
Any one have idea? is it correct network behavior? can i solve it without making same IP family.?
If you are using both IPs on the same LAN they should be on the same subnet ex:
11.1.1.1/24 can ping 11.1.1.44/24 but it can't ping 11.1.2.2/24 ( different subnets)
In WAN not necessary, for example 192.168.1.1 can ping 72.1.1.1 ,, but 72.1.1.1 can't ping 192.168.1.1 because this ip is private and when it leaves the LAN it becomes real ip because of NAT (Network Address Translation)
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I am developing a web app using Tomcat. I want to give a name (a domain name) like "google" to access my site.
How can I do that?
If you only want to give a fake, temporal domain name for demo purposes on your development computer, you can add a line in your hosts file (typically located in /etc/hosts in UNIX/Linux systems):
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
# My fake domain name for demo purposes
192.168.1.121 google.com
Then, when you open the 'google.com' domain name on your computer, it will redirect you to the specified IP address.
Note that this won't work if you want to access your application from other machines. You would have to make the same change in every computer's hosts file for that to happen.
And obviously, you won't be able to access the real google.com website while having that line in your hosts file.
For Windows systems, the only thing that changes is the location of the hosts file (you must be an Administrator to edit this file):
Windows XP/Vista/Windows7:
c:\windows\system32\drivers\etc\hosts
I think you need to read up on the Domain Name System (DNS). The RFC is a bit dry so maybe start with wikipedia.
Once you understand the basics it's time to purchase a domain from a registrar and set it up.
You need to register a domain name, then set up DNS records (including an A record that points the name to the IP address) on nameservers somewhere, and that IP address has to be accessible from the 'net. You may need web hosting for that, unless you have an always-on internet connection, in which case you need to configure your router to pass through port 80 traffic to the computer running the app.
There are many web hosting companies that will do the name registration and DNS setup and hosting for you if you host the site with them.
You need some hosting to get your site on the internet
You need to register a domain name and point it at your hosting
Most hosting companies provide both services, which means you don't need to worry about "HOW" you do any of this.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Not strictly a programming question, but I was programming at the time and couldn't find an answer, so I thought, "Hey, I'll give StackOverflow a try!"
So I'm connected to my Windows XP work PC over a Remote Desktop connection through VPN. In a command window (on the remote PC), I foolishly type ipconfig /release. A split second before I come to my senses, I hit Enter. D'oh!
So what now? Am I hosed until I get to the office Monday morning? Any way to remotely make my office PC get itself a new IP address?
If it makes you feel any better, most of us have done something similar. I can't offer a suggestion that doesn't involve human intervention, but I can offer two ways to prevent a "next time" for you:
Look into a remote power controller. Cheap (inexpensive, hobbyist-grade) options are available through www.x10.com; other vendors (Pulizzi, DataProbe, etc.) provide more reliable solutions for a higher price. You may even be able to find a UPS that allows you to control it via a serial port.
Plug your PC into the power controller, and find a second PC to control it. Now you can reboot your PC remotely, no matter how badly you de-configure it.
Anticipate and compensate. It's reasonable to expect that you may need to release/renew the IP address again, so write a utility that will check for the loss of IP address and reboot if that occurs. For example, ping your default gateway and reboot if the ping fails consistently. Just be sure to anticipate the consequences of an unexpected reboot!
Try giving a call to the office and get someone(if any) to restart your computer or ipconfig /renew
What you need to do, is find some way to cut the power to your PC. Many PCs are configured by default to reboot if there is a power failure. So, just hack into your power grid, and shut off power to the entire building. Once your computer reboots, along with all the other equipment, your computer should have it's IP back.
(This probably won't work)
I think if you get your network connection severed, it'll reset (like, if I run ipconfig /release, then shut off my router and restart it, I get a new IP).
It'd be well winging it, but if I was desperate I'd hook up to my DHCP server and reboot it.. I predict the end result would be me still not being able to connect, and the admins giving me a good whipping.
Log into the managed switch the PC is connected to, shutdown the port, wait a few seconds, and then bring it back up. If you don't have a managed switch or no access to it, wait until Monday.