• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

socket programming on windows

Hi

Question about network programming on windows

I've created an IP address with the 'route' command and pointed it to my machines network ip as its gateway. (in this case,192.168.1.1). I wrote a simple program to bind a socket to this new address for listening however, i get a response saying something like 'unable to bind to address', i know the program is fine because it binds alright to my loopback address.

Is there something I need to do be able to bind sockets to a newly created address with route?

0
dotnetisfun
Asked:
dotnetisfun
3 Solutions
 
InteractiveMindCommented:
Usually, when you get an error message such as:

   'unable to bind to address'

it means that either the IP address doesn't exist (or you can't gain access to it, perhaps due to a firewall), or another application is already listenning on that port (or something similar)..?

Double check.
0
 
RafaelklCommented:
you mean "created an IP address" is not really what it means....
route command is only a route table operation, it not really create a IP Address, that's why you can't bind on that ip.
here is the real way to create a additional ip address :
in startmenu->settings->Network connection->you local connection, enter to  property form,
select TCP/ip protocol, and click property button, and go into  "advance options",
then  Add a IP address by click "add" button on frame "IP Address".
0
 
Al faCommented:
I agree with Rafaelkl , he is right, Also I suggest when assigning a new IP address and manipulating the routing-table, before testing your program try to find if a real route exists between your mahine and the destination host with the 'tracert' or 'pathping' utilities.

----------------------------
 example of TRACEROUTE
----------------------------
--------------------------------------------------------
C:\>tracert 192.168.50.60

Tracing route to _gc._tcp.default-first-site-name._sites.mydomain.com [192.168.50.60
]
over a maximum of 30 hops:

  1    <1 ms    <1 ms    <1 ms  192.168.90.254
  2    <1 ms    <1 ms    <1 ms  192.168.30.253
  3    <1 ms    <1 ms    <1 ms  _gc._tcp.default-first-site-name._sites.mydomain.com
 [192.168.50.60]

Trace complete.

--------------------------------------------------------

----------------------------
example of PATHPING
----------------------------
--------------------------------------------------------
C:\>pathping 192.168.50.60

Tracing route to _gc._tcp.default-first-site-name._sites.mydomain.com [192.168.50.60
]
over a maximum of 30 hops:
  0  myhost.ecrcsp [192.168.90.163]
  1  192.168.90.254
  2  192.168.30.253
  3  _gc._tcp.default-first-site-name._sites.mydomain.com [192.168.50.60]

Computing statistics for 75 seconds...
            Source to Here   This Node/Link
Hop  RTT    Lost/Sent = Pct  Lost/Sent = Pct  Address
  0                                           myhost.ecrcsp [192.168.90.163]
                                0/ 100 =  0%   |
  1    0ms     0/ 100 =  0%     0/ 100 =  0%  192.168.90.254
                                0/ 100 =  0%   |
  2  ---     100/ 100 =100%   100/ 100 =100%  192.168.30.253
                                0/ 100 =  0%   |
  3    0ms     0/ 100 =  0%     0/ 100 =  0%  _gc._tcp.default-first-site-name._
sites.mydomain.com [192.168.50.60]

Trace complete.

C:\>
--------------------------------------------------------

whish that helps,
Ali.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now