minor changes
parent
6679ce8e61
commit
e1b1e41e00
|
@ -3,13 +3,10 @@
|
|||
Buffer::Buffer( int _id )
|
||||
{
|
||||
id = _id;
|
||||
|
||||
// allocate memory
|
||||
}
|
||||
|
||||
Buffer::~Buffer()
|
||||
{
|
||||
// deallocate memory
|
||||
}
|
||||
|
||||
void Buffer::set(frame_t data)
|
||||
|
|
|
@ -22,6 +22,16 @@ void Server::launch_threads()
|
|||
threads.push_back( Glib::Thread::create( sigc::mem_fun(this, &Server::mix), false ) );
|
||||
}
|
||||
|
||||
|
||||
/* this listens for UDP connections on a port and waits until there is data,
|
||||
processes it and repeats */
|
||||
|
||||
/* TODO
|
||||
error and format checking
|
||||
clean exit conditions
|
||||
ability for one client to take over the display
|
||||
*/
|
||||
|
||||
void Server::listen()
|
||||
{
|
||||
int packetcounter = 0;
|
||||
|
@ -30,13 +40,15 @@ void Server::listen()
|
|||
boost::asio::io_service io_service;
|
||||
|
||||
// next line is NOT thread-safe because we're accessing "port" without lock
|
||||
// however, it is done only once before any other threads are started and
|
||||
// should be safe
|
||||
udp::socket socket(io_service, udp::endpoint(udp::v4(), port));
|
||||
|
||||
cout << "listening" << endl;
|
||||
for (;;)
|
||||
while (1)
|
||||
{
|
||||
frame_t frame;
|
||||
boost::array<char, 200> recv_buf;
|
||||
boost::array<char, BUFLEN> recv_buf;
|
||||
udp::endpoint remote_endpoint;
|
||||
boost::system::error_code error;
|
||||
|
||||
|
@ -80,6 +92,7 @@ void Server::listen()
|
|||
std::string message = "received";
|
||||
|
||||
boost::system::error_code ignored_error;
|
||||
// we can provide feedback to clients
|
||||
//socket.send_to(boost::asio::buffer(message),
|
||||
// remote_endpoint, 0, ignored_error);
|
||||
}
|
||||
|
@ -90,6 +103,11 @@ void Server::listen()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* the framemixer, this periodically (40 times a second) reads all input
|
||||
buffers and then produces output, ready to be displayed.
|
||||
In the final version, this is where interesting things will happen.
|
||||
*/
|
||||
void Server::mix()
|
||||
{
|
||||
int size = 0;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __DEFINES_H_
|
||||
#define __DEFINES_H_
|
||||
#define BUFLEN 1024
|
||||
#define NUMBUFS 100
|
||||
#define WIDTH 12
|
||||
#define HEIGHT 7
|
||||
#define SEGWIDTH 12
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
i="0"
|
||||
|
||||
while [ 1 ]
|
||||
do
|
||||
echo "$1" | cat - display | netcat -q 0.1 -u 127.0.0.1 4321
|
||||
|
|
Binary file not shown.
|
@ -12,10 +12,7 @@
|
|||
#include "Buffer.h"
|
||||
#include "Buffers.h"
|
||||
|
||||
#define NUMBUFS 10
|
||||
|
||||
using namespace std;
|
||||
Buffers* buffers;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
@ -25,7 +22,7 @@ int main(void)
|
|||
// our main loop with support for signals and all that jazz
|
||||
Glib::RefPtr<Glib::MainLoop> Main = Glib::MainLoop::create();
|
||||
|
||||
Server server(10,4321);
|
||||
Server server(NUMBUFS,4321);
|
||||
server.launch_threads();
|
||||
|
||||
Main->run();
|
||||
|
|
Loading…
Reference in New Issue