Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to clear a thing, Is It not possible to send a request from client to server on port "XXXX" and getting back the response from servers port "YYYY"?

Please help me...
Posted
Comments
ZurdoDev 13-Nov-15 7:50am    
That is how UDP works. The port one side listens to is the same as the port the other side sends to. And then vice versa.
Richard MacCutchan 13-Nov-15 7:54am    
Yes, it is possible, and often happens. It really does not matter which port the server sends on since the client does not need that information.
Awesh Vishwakarma 13-Nov-15 7:56am    
thank you! how could i achieve it?
Richard MacCutchan 13-Nov-15 8:27am    
By studying socket communication and developing your code. Google will find many examples, tutorials etc.

As mentioned in the comments, this is how UDP communication works. The client will listen on port X and send on port Y. Therefore, the server will listen on port Y and send on port x. Very common scenario.
 
Share this answer
 
Comments
Awesh Vishwakarma 13-Nov-15 8:08am    
Sir, i am unable to find any sample code for it, Please provide me any link or code for it. This will be a great help to me. thank you!
CPallini 13-Nov-15 8:16am    
There's nothing preventing you to write a request to a port and receiving the answer on another port.
CPallini 13-Nov-15 8:15am    
Have my 5.
Awesh Vishwakarma 13-Nov-15 8:22am    
I have worked only on the same ports. As i am new to the Socket Programming i am one bit afraid of the things. any code or example is expected...Please
ZurdoDev 13-Nov-15 8:26am    
There are tons and tons of samples online as well as many on this site. Here is a link to search the articles for c# and udp. This has many examples to help you get going.

http://www.codeproject.com/search.aspx?q=c%23+udp&doctypeid=1%3b2%3b3%3b13%3b14
I have found a solution and believe me it is working fine...

All we have to do is to use Socket's "SendTo()" and "receiveFrom()" methods with the desired IPEndPoints
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900