Created
March 28, 2011 14:57
-
-
Save mjul/890616 to your computer and use it in GitHub Desktop.
Publish a HTML5 Server-Sent Event to a local Kaazing WebSocket Gateway server via UDP from C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Net.Sockets; | |
using System.Text; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace Test.Playground | |
{ | |
[TestClass] | |
public class KaazingPublishTest | |
{ | |
public void Publish(String message) | |
{ | |
var host = new IPAddress(new byte[] { 127, 0, 0, 1 }); | |
var port = 50505; | |
var udpClient = new UdpClient(); | |
var ipEndPoint = new IPEndPoint(host, port); | |
Byte[] bytes = Encoding.Unicode.GetBytes(message); | |
udpClient.Send(bytes, bytes.Length, ipEndPoint); | |
} | |
[TestMethod] | |
public void PublishMessage() | |
{ | |
Publish("Hello from .NET"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment