Reputation: 12799
I have several "blackbox" that sends data to determinated IP and PORT, I can´t specify anything else (just IP and PORT)...
My server should be listening that PORT and catch information to send to MSMQ...
How can I set a WCF server to listening that PORT?
Thanks!
Upvotes: 1
Views: 328
Reputation: 56381
If you can control what's pushing data to the IP address/port, then yes, you could use WCF. Unfortunately, without some sort of contract/binding to specify the means by which your "server" and your "client" communicate, WCF won't help you much.
So if you can't control the client code, you'll need to "roll your own" listener. As @Rob Stevenson-Leggett suggested: TcpListener
Edit:
Thanks Randolpho... So, I´ll develope a Windows Service with the listener and add the message to MSMQ. And in the otner hand, I need a module to read the queue (MSMQ) and add that to DB... That module could be in WCF? What you think?
Yep. WCF provides the MsmqIntegrationBinding for communicating on either end with an MSMQ.
Here's a nice tutorial:
http://msdn.microsoft.com/en-us/library/ms789008.aspx
Upvotes: 2
Reputation: 35679
I would write a normal windows service that listens for the data.
Use the TCPListener or a similar class
Then plug on WCF as a seperate service that your windows service calls to write to the message queue, it's just a matter of configuration.
[ServiceContract]
public interface IDaraWriterService
{
[OperationContract]
public void WriteDataToQueue(WriteDataToQueueMessage theDataEncapsulatedInAMessage)
{
}
}
Your windows service could probably write to the queue directly btw.
See here for more info on the message queue. http://msdn.microsoft.com/en-us/library/ms811053.aspx
Upvotes: 3