Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows Linux QT QT-Creator , +
hi every one
i'll hope everything being ok
i have a valid ip on my laptop and in my laptop i have a local netrok
how can i write a program that i can access to this program
this is base on socket
everything is good
but maybe i should to use of setup NAT with use of my program
so now my code is base qt and c++
do you know can i do it??
in windows
Posted 15-Dec-12 2:02am
rpm3d520

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You do NOT need to implement NAPT in your software at all, as it should all be done by the firewall (in your setup, the router).
 
1) Learn about Windows Sockets (winsock), in particular pay attention to concept of source and destination addresses and port numbers.
 
2) Write a program which will implement communicatins between 2 PCs (I am assuming this is what you want to achieve at least). One will be the client the other will be the server.
 
3) Test the program in a setup where both client and server are on the same network (subnet). Make sure everything works correctly.
 
Below are the steps required if you want to, for example, allow external clients to connect to your server.
 
4) Set up NAT, or more correctly, NAPT in your router. You will need to map a port number to a local IP address that is not visible from outside your local network. For example, you can configure the router so that all external incoming connections on, for example, port 10100 are forwarded to IP address, for example, 192.168.0.5 (which is the IP address of the server on your local network).
 
5) The external client on the Internet should now be able to connect to the server if it uses the correct port number (as selected in step 4) and the correct public IP address of your router.
 
6) Your client-server program should work transparently with no software changes.
  Permalink  
Comments
rpm3d at 18-Dec-12 0:39am
   
thank you i get your point..but i make all of your say before

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

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 17 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100