MISCELLANEOUS TIDBITS
TCPSocket.Address is used only to specify the address to connect to. REALbasic does not modify this property at all. This is in contrast to TCPSocket.RemoteAddress, which specifies the remote IP address of the machine you are trying to connect to. If you set TCPSocket.Address to “www.google.com”, then REALbasic will, upon connection, set TCPSocket.RemoteAddress to Google’s IP address (”216.239.39.101″). Before the connection has occurred, and after the connection terminates, TCPSocket.RemoteAddress will be an empty string.
What this means is: don’t rely on TCPSocket.Address to give you any useful information. It is there strictly to tell REALbasic where to attempt a connection. If you want information about the connection, use TCPSocket.RemoteAddress.
Because REALbasic does not modify the TCPSocket.Address property, there can be situations where this property is an empty string. For example, when using a ServerSocket, the TCPSockets that have a connection handed off to them will not have their TCPSocket.Address property set.
TCPSocket.DataAvailable events will only fire once control has been given back to REALbasic’s internals. This means that if you have code executing in a tight loop somewhere, your TCPSocket’s DataAvailable event won’t get the chance to fire until your code is done executing, or you call SocketCore.Poll. The DataAvailable event will fire once per chunk of data received. This means that if you do not read all the data from the buffer, we won’t fire another DataAvailable event until new data arrives. Also, the DataAvailable event is not reentrant, so you will never have to worry about getting a new DataAvailable event while processing the current one.
UDPSocket.DataAvailable events will fire when at least one new packet has arrived in REALbasic’s internal packet queue. It is possible (likely even), that more than one packet will have arrived. We only give you one DataAvailable event for a discrete set of packets. This means that you will need to loop over the PacketsAvailable property of the UDPSocket in order to read all of the packets in. If any packets come in while you are processing a DataAvailable event, we will fire the DataAvailable event for you again.
Leave a Reply
You must be logged in to post a comment.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13