|
|
@@ -5,7 +5,52 @@
|
|
|
|
|
|
#include "framework.h"
|
|
|
|
|
|
-void deadrec_keys(EventHandler& eh) {
|
|
|
+#include <dconfig.h>
|
|
|
+
|
|
|
+NotifyCategoryDecl(deadrec, EXPCL_MISC, EXPTP_MISC);
|
|
|
+NotifyCategoryDef(deadrec, "");
|
|
|
+
|
|
|
+Configure(deadrec);
|
|
|
+
|
|
|
+ConfigureFn(deadrec) {
|
|
|
+}
|
|
|
+
|
|
|
+static PT_Node smiley;
|
|
|
+static RenderRelation* my_arc;
|
|
|
+string hostname = deadrec.GetString("deadrec-rec", "localhost");
|
|
|
+int hostport = deadrec.GetInt("deadrec-rec-port", 0xdead);
|
|
|
+
|
|
|
+static QueuedConnectionManager cm;
|
|
|
+PT(Connection) conn;
|
|
|
+ConnectionWriter* writer;
|
|
|
+
|
|
|
+static void deadrec_setup(void) {
|
|
|
+ static bool done = false;
|
|
|
+ if (done)
|
|
|
+ return;
|
|
|
+ // load smiley and put it in the scenegraph
|
|
|
+ smiley = ModelPool::load_model("smiley");
|
|
|
+ nassertv(smiley != (Node*)0L);
|
|
|
+ my_arc = new RenderRelation(render, smiley);
|
|
|
+ // open a connection to the receiver
|
|
|
+ NetAddress host;
|
|
|
+ if (!host.set_host(hostname, port)) {
|
|
|
+ deadrec_cat->fatal() << "Unknown host: " << hostname << endl;
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ conn = cm.open_TCP_client_connection(host, 5000);
|
|
|
+ if (conn.is_null()) {
|
|
|
+ deadrec_cat->fatal() << "no connection." << endl;
|
|
|
+ exit();
|
|
|
+ }
|
|
|
+ if (deadrec->is_debug())
|
|
|
+ deadrec->debug() << "opened TCP connection to " << hostname << " on port "
|
|
|
+ << c->get_address().get_port() << " and IP "
|
|
|
+ << c->get_address() << endl;
|
|
|
+ writer = new ConnectionWriter(&cm, 0);
|
|
|
+
|
|
|
+static void deadrec_keys(EventHandler& eh) {
|
|
|
+ deadrec_setup();
|
|
|
}
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|