public static void Run() { var server = new KayakServer(); var pipe = server.Invoke(new SimpleApp(Respond)); Console.WriteLine("Press enter to exit."); Console.ReadLine(); pipe.Dispose(); }
public static void Run() { var server = new KayakServer(); var pipe = server.UseFramework(); Console.WriteLine("Press enter to exit."); Console.ReadLine(); pipe.Dispose(); }
protected override void OnStart(string[] args) { server = new KayakServer(); server.UseFramework(); server.Start(new IPEndPoint(IPAddress.Any, 8777)); }
internal KayakContext(KayakServer server, Socket socket) { Server = server; Socket = socket; Request = new KayakRequest(socket); Response = new KayakResponse(socket); Items = new Dictionary<object, object>(); Activator = new KayakActivator(); }
// TODO this should take a Port number public static void Run(IApplication application) { KayakServer server = new KayakServer(); IDisposable pipe = server.Invoke(application) as IDisposable; Console.WriteLine("KayakServer is running at http://localhost:8080/"); Console.WriteLine("Press any key to exit"); Console.Read(); pipe.Dispose(); }
static void Main(string[] args) { var server = new KayakServer(); var behavior = new KayakFrameworkBehavior(); behavior.JsonMapper.SetOutputConversion<int>((i, w) => w.Write(i.ToString())); var framework = server.UseFramework(); Console.WriteLine("Kayak listening on " + server.ListenEndPoint); Console.ReadLine(); // unsubscribe from server (close the listening socket) framework.Dispose(); }
public void Start(int PortHTTP,int PortTCP) { if (mStarted) { return; } mStarted = true; mPortHttp = PortHTTP; mPortTcp = PortTCP; // HTTP KayakServer server = new KayakServer(); server.UseFramework(); server.Start(new IPEndPoint(IPAddress.Any,mPortHttp)); // TCP ValTcpService ts = new ValTcpService(mPortTcp); DoLoop(); }
static void Main(string[] args) { /* NOTE: This info is out-of-date * * Basic Operation: * 1. Listen on port 8000 for http connection * * For each playlist: * 2. PHONE posts "xyz.m3u" * 3. SERVER Infer the name of the playlist from the file name. * 4. SERVER look for the playlist in iTunes and generate an m3u file. * 5. SERVER sort and then diff Phone playlist and iTunes generated playlist. * 6. SERVER respond with Json to the phone instructing it what to do: * { * "Server" : "wirelessSyncServer", * "Playlist": "http://192.168.0.104:8000/xyz.m3u" , * "Get" : * [ * { * "RemoteId" : "http://192.168.0.104:8000/songs/iTunesID", * "LocalPath" : "file://....." * }, * { * "RemoteId" : "http://192.168.0.104:8000/songs/iTunesID", * "LocalPath" : "file://....." * } * ], * * "Delete" : * [ * { * "LocalPath" : "file://....." * }, * { * "LocalPath" : "file://....." * } * ] * } * 7. PHONE parses JSON * 8. PHONE Downloads remote songs to phone. * 9. PHONE Deletes removed songs. * 10. PHONE Dowloads new playlist and replaces the old one. * 11. Hopefully music player will auto update. */ XmlConfigurator.Configure(new FileInfo("server.log.config")); Application.ThreadException += Application_ThreadException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ServerService.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ServerService_PropertyChanged); var server = new KayakServer(new System.Net.IPEndPoint(0, Settings.Default.Port)); var behavior = new KayakFrameworkBehavior(); behavior.JsonMapper.SetOutputConversion<int>((i, w) => w.Write(i.ToString())); var framework = server.UseFramework(); Log.Info("Now: " + DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString()); Log.Info("Wifi Sync Server listening on " + GetIP() + ":" + server.ListenEndPoint.Port); notifyIcon = new NotifyIcon(); MenuItem exitMenu = new MenuItem("Exit", (sender, e) => { notifyIcon.Visible = false; Application.Exit(); }); MenuItem controlPanelMenu = new MenuItem("Show Control Panel", (sender, e) => { Process.Start(GetAccessUrl()); }); notifyIcon.Icon = Resources.music_sync_server; notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { controlPanelMenu, exitMenu }); notifyIcon.Text = Application.ProductName + "\n" + ServerService.Status; notifyIcon.Visible = true; Application.EnableVisualStyles(); Application.Run(); // unsubscribe from server (close the listening socket) framework.Dispose(); Log.Info("All this has happened before, and all this will happen again."); }