Hi, i am emulating joystick, so far i am able to read joystick values and display them on screen, but i want to send them to another computer using tcp socket. I am able to create a socket but can any one tell me how can i gather all the values and send them to tcp socket

Joystick reader

Qt Code:
  1. #include "mainwindow.h"
  2. #include "ui_mainwindow.h"
  3.  
  4.  
  5.  
  6. MainWindow::MainWindow(QWidget *parent) :
  7. QMainWindow(parent),
  8. ui(new Ui::MainWindow)
  9. {
  10. ui->setupUi(this);
  11. QTimer* timer = new QTimer(this);
  12. joystick = new Joystick();
  13. connect(timer, SIGNAL(timeout()), this, SLOT(updateForm()));
  14. connect(ui->btnConnect,SIGNAL(clicked()),this, SLOT(joyConnect()));
  15. }
  16.  
  17. MainWindow::~MainWindow()
  18. {
  19. delete ui;
  20. }
  21.  
  22. void MainWindow::joyConnect()
  23. {
  24. if(joystick->init(joyAccess->text().toAscii()) > -1)
  25. {
  26. ui->btnConnect->setText("Connected");
  27. timer->start();
  28. }
  29.  
  30. }
  31. void MainWindow::updateForm()
  32. {
  33. ui->lcd1->display(joystick->getAxis(0));
  34. ui->lcd2->display(joystick->getAxis(1));
  35. ui->lcd3->display(joystick->getAxis(2));
  36. ui->lcd4->display(joystick->getAxis(3));
  37.  
  38.  
  39. if(joystick->getButton(0) > 0)
  40. ui->label_1->setText("UP");
  41. else
  42. ui->label_1->setText(" Axis1");
  43.  
  44. if(joystick->getButton(1) > 0)
  45. ui->label_2->setText("Down");
  46. else
  47. ui->label_2->setText(" Axis2");
  48.  
  49.  
  50. if(joystick->getButton(2) > 0)
  51. ui->label_3->setText("UP");
  52. else
  53. ui->label_3->setText(" Axis3");
  54.  
  55.  
  56. if(joystick->getButton(3) > 0)
  57. ui->label_4->setText("UP");
  58. else
  59. ui->label_4->setText(" Axis4");
  60.  
  61. }
To copy to clipboard, switch view to plain text mode