From the course: Developing Distributed Applications with C# and ZeroMQ
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Exercise 1b: Setting up the client
From the course: Developing Distributed Applications with C# and ZeroMQ
Exercise 1b: Setting up the client
- [Instructor] Now we can construct our chat client. As with other examples, many files in this project are boiler plate and are not strictly relevant to zeromq. However, the ChatZAgent.cs file is relevant. It defines a static class called proxy which will serve as a go-between for our relay server and the WPF user interface. To start with, we will create an observable subject which is the connected user information. Ultimately, we will use this to push information to our user interface. Next, you'll see we've defined a single static function called start which will create a background task that does the actual communication with our server. The first step as always in communicating with zeromq is to create a new context. Once we've done that, we can create and configure a new socket. Here we're creating a dealer socket because we want to hook into a synchronous message exchange. We're also configuring the socket using the SetOption method which lets us set a number of different…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.