1

I work with C# in my spare time and have written a number of programs as one of my hobbys. So I dont consider myself a programmer, I just like to write solutions for problems I come across.

My latest problem is.. I have written a C# program that needs to gain data from other people using the same application.

It's a voice application and the data I need to gain from the others is their nickname, what channel they are in, how to contact them etc etc.

The Linux part.. At the moment I start my app and it reads information from a file on the web, adds my information to the file and then uploads it back over FTP.

Whenever the information changes, my app repeats this ( reads, adds and uploads).

Other users of the app do exactly the same (read, add, upload) which results in everybody seeing who is online and how to contact them.

The file is hosted on two linux web servers. One is a hosting plan with a hosting company (running on red hat I think), the other a Centos 7 box in my garage. I use 2 servers for redundancy, so if one cant the accessed the other server can be used.

The problem... As multiple users are using this app at the same time, my hosting company is flagging up security issues as FTP is being used a lot in short periods from IP addresses all around the world.

My Centos box seems to be ok with this method, but uploading over ftp everytime I need to update seems a bit messy to me and wrong somehow.

I've read about Web APIs that not only confused me, but seem to be mostly targetted at windows servers and I'm assuming would require my hosting company to open a port?

I know there must be an easier/better way to do what I'm doing. I just cant think what that might be and would appreciate suggestions.

Roo
  • 11
  • 2
  • You may want to solve that with REST APIs. You can use a http server for that. You can do in almost any language and os. From Rust to C# to PHP. PHP might be easier because it tends to be available on some hosting plans, but on a dedicated server you can use what you want. This question is probably better suited for stack overflow, after some reading. Googling `rest api yourlanguage` should get you started. – rudib Aug 24 '19 at 12:05
  • Thank you rudib, I have slightly read up on rest api but it did confuse me. Would my hosting company need to open a port to use one or would I be able to access it through php from my c# app somehow? I'll do some more reading unless somebody else has an idea. – Roo Aug 24 '19 at 18:14
  • It would work roughly like that: your app sends an http(s) request to the server and the server side application processes it, stores or fetches the data and sends a response to the app. You'd have to implement that on the server side. Note that the rest server is still accessible like a web page. So your `yourdomain.com/upload.php` could receive and process an upload via `POST`. And `GET` `/status.php?group=mygroup` could return information on a group. If you are using php and it's included in the hosting, you shouldn't need to enable anything. – rudib Aug 24 '19 at 19:48
  • But if you want to run a custom server (e.g. [express](https://expressjs.com) or [rocket](https://rocket.rs/) or ...), you will need full control of the server to actually install it. – rudib Aug 24 '19 at 19:51
  • Well after a crash course in APIs php and SQL I've managed to put something together. Thank you rudib – Roo Sep 09 '19 at 21:01

0 Answers0