.NET フレームワーク 3.5。サーバー側にはインターフェースがあります
public interface IClientCallback
{
[OperationContract(IsOneWay = true)]
void ReceiveBroadcast(string nickname, string message);
[OperationContract(IsOneWay = true)]
void ReceivePrivate(string nickname, string message);
[OperationContract(IsOneWay = true)]
void UserJoined(string nickname);
[OperationContract(IsOneWay = true)]
void UserLeft(string nickname);
}
svcutil を使用すると、次のインターフェイスが生成されます
public interface IServerCallback
{
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://tempuri.org/IServer/ReceiveBroadcast")]
void ReceiveBroadcast(string nickname, string message);
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, AsyncPattern=true, Action="http://tempuri.org/IServer/ReceiveBroadcast")]
System.IAsyncResult BeginReceiveBroadcast(string nickname, string message, System.AsyncCallback callback, object asyncState);
void EndReceiveBroadcast(System.IAsyncResult result);
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://tempuri.org/IServer/ReceivePrivate")]
void ReceivePrivate(string nickname, string message);
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, AsyncPattern=true, Action="http://tempuri.org/IServer/ReceivePrivate")]
System.IAsyncResult BeginReceivePrivate(string nickname, string message, System.AsyncCallback callback, object asyncState);
void EndReceivePrivate(System.IAsyncResult result);
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://tempuri.org/IServer/UserJoined")]
void UserJoined(string nickname);
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, AsyncPattern=true, Action="http://tempuri.org/IServer/UserJoined")]
System.IAsyncResult BeginUserJoined(string nickname, System.AsyncCallback callback, object asyncState);
void EndUserJoined(System.IAsyncResult result);
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, Action="http://tempuri.org/IServer/UserLeft")]
void UserLeft(string nickname);
[System.ServiceModel.OperationContractAttribute(IsOneWay=true, AsyncPattern=true, Action="http://tempuri.org/IServer/UserLeft")]
System.IAsyncResult BeginUserLeft(string nickname, System.AsyncCallback callback, object asyncState);
void EndUserLeft(System.IAsyncResult result);
}
ご覧のとおり、すべての操作は一方向ですが、End* および Begin* メソッドを提供します。原因は何ですか?AsyncPattern = false を IClientCallback メソッドに追加しようとしましたが、結果はありませんでした。