Connect to server within open source application [closed]
开发者_开发百科
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 questionWhat is the best, most secure way to connect to a server such as a mysql server, from within a program that's source code will be released? I'm trying to keep from just giving out an ip address. Sorry if this is a bad or simple question, I am really new to network centered programming.
You can have a file that holds that info and then the program just reads from there, or you can have that info in a source code file that you include in the main program. Just don't share them with the rest of the source code and you're set ;)
e.g.
readDataFromFile("confidential.dat")
or
#include "confidential.h"
(...)
You would do this the same way you would make pi into a rational number. You can't make an IP address in a distributed program a secret. 'netstat' if nothing else will reveal it as soon as the program makes a connection to your server.
精彩评论