I used the network-transport-tcp-0.5.1 for creatipn TCP transport.
resultCT <- createTransport host port defaultTCPParameters
But now I'm using the package network-transport-tcp-0.6.0 and getting an error because of the new type:
createTransportExposeInternals
:: N.HostName
-> N.ServiceName
-> (N.ServiceName -> (N.HostName, N.ServiceName))
-> TCPParameters
-> IO (Either IOException (Transport, TransportInternals))
How can I use default value for (N.ServiceName -> (N.HostName, N.ServiceName))? Maybe there are some examples? Thank you!
When you choose a
port
,createTransport
might not use the given port. For example, you might use the port"0"
, which means that any port might get used. Depending on the used port, the external host name or service can differ vastly. For example, your firewall will only forward the ports 1000-2000 ona.qspider
, and 2000-3000 onb.qspider
. Therefore, if you bind on 1320, your external host and service name would bea.qspider:1320
.Alternatively, you have configured your ports to forward
8080
to80
externally, so theServiceName
8080
would result in80
+ external address.All in all the additional parameter provides you a method to handle external port forwardings and host names correctly. If you don't have any external networks at that point, you can simply use