Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   FRC Java TCP client (http://www.chiefdelphi.com/forums/showthread.php?t=130393)

yash101 30-08-2014 18:34

Re: FRC Java TCP client
 
I am actually now going to use a web server. Since I am using dclib, a web server is a no-brainer and only requires like 5 lines of code! I think I'll use the HttpClient in the cRIO from there! That should work just perfectly. It is the lag that I think of, though :(

The nice thing, however, is that I can now send POST messages and "inject" values into the serve table. If one table is not good enough, I can also spawn multiple servers with multiple ports too!

JesseK 01-09-2014 15:29

Re: FRC Java TCP client
 
A web server could be interesting. We just got done experimenting with algorithmic JSON interpretation at work, and it is really promising for fast network comms.

yash101 01-09-2014 15:46

Re: FRC Java TCP client
 
4 Attachment(s)
I think I am just about done! I have even written a web interface, so the drivers can access the stored variables! It is really fast too and uses 0.7% CPU of one core on my i3 1.4GHz.
I have attached some screenshots. Also, I use a RAM cache (which is written in STL), so page loads are almost instant!

The code (as usual), is in my GitHub "Other" repositiory, here

I also have my server up at the moment, here.

orangelight 01-09-2014 16:28

Re: FRC Java TCP client
 
Quote:

Originally Posted by yash101 (Post 1398644)
I think I am just about done! I have even written a web interface, so the drivers can access the stored variables! It is really fast too and uses 0.7% CPU of one core on my i3 1.4GHz.
I have attached some screenshots. Also, I use a RAM cache (which is written in STL), so page loads are almost instant!

The code (as usual), is in my GitHub "Other" repositiory, here

I also have my server up at the moment, here.

Looks cool, I may look into HTTP servers after I get done with what I want todo with my TCP one.

yash101 01-09-2014 16:51

Re: FRC Java TCP client
 
The web server implementation was extremely simple. If you noticed, I am using DLib. DLib adds some of the simplest socket APIs you could imagine!

PHP Code:

class web_server : public server_http
{
    const 
std::string on_request(const incoming_thingsincomingoutgoing_thingsoutgoing)
    {
        return 
"<html><body><h1>Hello World!</h1></body></html>";
    }
}; 

I used this, plus a bunch of HTML + CSS + JavaScript skills to make this. I think I should make a new thread about this software because it is something that many teams might want for communications. The main problem is speed, but it has an extremely vast feature set!

orangelight 01-09-2014 19:23

Re: FRC Java TCP client
 
I was thinking about making android apps for my team to do debugging and testing next year. But I don't know what the delay should be for the client to ask the robot server for information about sensors and motors.

yash101 01-09-2014 23:33

Re: FRC Java TCP client
 
It ends up that my program is designed flexibly so you can run it on any device with a web browser. It requires HTML5 for some nifty features, though. However, I have designed it for webkit-based devices because cross-browser adds tons of unnecessary code when adding display things, like animations, visual ques, etc.


I just generated a CMakeLists.txt, so just copy-and-paste the code into your platform, run make clean, cmake ., and then make! You can then run the project. I also have removed a great portion of DLib functionality because it is unnecessary! I kept getting X11 errors because I didn't link it. However, I was using the preprocessor to not compile that code, so I don't know what is up with that!

I am still developing this appication. However, if you want to download and compile it in Linux, here's my compile script:
PHP Code:

$~ wget https://github.com/yash101/Other/raw/master/DLib/DevNodeServer/DevServer2/CMAKE_STANDALONE/install.sh && chmod +x install.sh && ./install.sh 

To change the port number, use the install script. Enter the folder dserv/src. Edit config.hpp, and change the PORTNO definition to your favorite port!

Enjoy! I will roll out Java and C++ APIs when I have the ability to test them!


All times are GMT -5. The time now is 22:17.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi