Archived

This topic is now archived and is closed to further replies.

redmonkey

how do i lookup a port with winsock?

Recommended Posts

redmonkey    122
im currently using tsock (http://www.ward.nu/computer/tsock) with my game, (based on udp) but when the game starts, im checking for the host etc to make sure my game doesnt throw up errors... this works fine: result:=(WinSock.GetHostByName(PChar(host))<>nil); and checks for an existing host, but im having trouble finding out wether or not the port is open on the said machine. when i open the socket with tsock it throws up an error (GPF) and then closes the socket (w/o killing the game) does winsock have a built-in function to check for a open port on a remote host? __________________ graham "red" reeves. red@deadpenguin.org www.deadpenguin.org

Share this post


Link to post
Share on other sites
Sly    128
With UDP, if the port is not listening on the remote machine, then the packet is merely lost. There is no indication to the sending host that the packet did not arrive. That is the nature of UDP. It is a connectionless unreliable protocol. The sender just sends packets without any idea if they are getting there or not, or if anyone is listening to them or not. I think there might be a problem within TSock if it is causing a GPF. I am not familiar with TSock. I use Francois Piette''s TWSocket.

Does TSock require you to open the socket to send a UDP datagram? Since UDP is a connectionless protocol, it technically does not need a connection to opened.



Steve 'Sly' Williams
Tools Developer
Krome Studios

Share this post


Link to post
Share on other sites
redmonkey    122
it doesnt actaully open a connection to the host, it initializes the winsock structures. But its not when it opens, it seems to be before it sends the first packet :/

im probably just using it wrong, ill change over the a difffrent compoanent or leanr to write winsock stuff from scratch

__________________
graham "red" reeves.

red@deadpenguin.org
www.deadpenguin.org

Share this post


Link to post
Share on other sites