Revize 79227a05
Přidáno uživatelem Eliška Mourycová před téměř 4 roky(ů)
Server/ServerApp/Connection/ConnectionListenerMulti.cs | ||
---|---|---|
3 | 3 |
// |
4 | 4 |
|
5 | 5 |
using ServerApp.Connection.XMLProtocolHandler; |
6 |
using ServerApp.Predictor; |
|
6 | 7 |
using System; |
7 | 8 |
using System.Collections.Concurrent; |
8 | 9 |
using System.Collections.Generic; |
... | ... | |
153 | 154 |
public class ConnectionListener |
154 | 155 |
{ |
155 | 156 |
private readonly int PORT; |
157 |
private IPredictionController predictionController; |
|
156 | 158 |
|
157 |
public ConnectionListener(int port) |
|
159 |
public ConnectionListener(int port, IPredictionController predictionController)
|
|
158 | 160 |
{ |
159 | 161 |
this.PORT = port; |
162 |
this.predictionController = predictionController; |
|
160 | 163 |
} |
161 | 164 |
|
162 | 165 |
public void StartListening() |
... | ... | |
240 | 243 |
response.AddHeader("Access-Control-Allow-Origin", "*"); |
241 | 244 |
|
242 | 245 |
|
246 |
Response responsePrediction = predictionController.Predict(requestDeserialized); |
|
243 | 247 |
|
244 | 248 |
int rand = new Random().Next(1, 10); |
245 | 249 |
string msg = "OK " + rand; |
246 | 250 |
|
251 |
msg = XmlCommunication.Serialize(responsePrediction); |
|
252 |
|
|
247 | 253 |
byte[] buffer = Encoding.UTF8.GetBytes(msg); |
248 | 254 |
|
249 | 255 |
response.ContentLength64 = buffer.Length; |
Také k dispozici: Unified diff
Re #8943. Untested integration with Model.