Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send tcp packet from receiver to sender using winsock API in Powerbuilder 12.5 1

Status
Not open for further replies.

johnf23

Programmer
Mar 26, 2013
2
0
0
GR

Hello!,

As I have to implement some winsock services in our Powerbuilder 12.5 project I have the following issue:

Suppose we have sender S that sends ( initiate communication ) data to receiver R. How can R identify the channel ( IP and port ) of sender that sender uses in order to send back to sender a reply ?

Thank you in advance for your time and cooperation.

John.
 
The point is that I want the listener application to send back a message ( let's say 'Hello!' ) to the sender's application, without knowing the actual IP and port. So I want to find a way to discover sender IP from the listener application. Let's say that I want to answer back to the same channel that initiate the communication from the sender part. How can this implemented with Roland Smith's winsock example ?

Thanks!
John.
 
If you take a look at my example that he gave the link to, it does just that. I have a function to get the IP address of the remote computer but you don't need to know the IP address of the remote computer to reply.

Download the example and open the object u_tabpg_tcpip_listen. Look at the event ue_listen. FD_ACCEPT is the program accepting the connect request. You can see a call to of_GetPeerName which gives you the IP Address. FD_READ is the program receiving the sent data via a call to of_Recv. Then it calls of_Send to send a reply. Open the object u_tabpg_tcpip_send and look at the clicked event of cb_send. First calls of_Send to send the data and then calls of_Recv to receive the reply.

The example comes in PB8 and PB10 versions. You can migrate the PB10 version to PB 12.5.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top