Thanks.

Here is a representative sample example of binding a socket.

sd = socket(PF_INET, SOCK_DGRAM, 0);
if ( sd < 0 )
{               
   perror("socket");
   exit(1);
}
addr.sin_family = AF_INET;
addr.sin_port = htons(SERVER_PORT);
addr.sin_addr.s_addr = INADDR_ANY;
if ( bind(sd, (struct sockaddr*)&addr, sizeof(addr)) < 0 )
{
   perror("bind");
   exit(1);
}

In libxml2, the sample code used an API, htmlreadfile(URL, ...).
I have checked a source code of that function, but I haven't found any
low level program part.
I think at least I have to know about socket that libxml2 uses
currently, then I can call bind(known_socket, ,,..)
However, i do not where it is.
Could you please tell me how to associate binding sockets with libxml2
library in the source level?

Thanks.


On Tue, Jul 28, 2009 at 12:47 PM, Michael Hanson<[email protected]> wrote:
> Brian -
>
> That sort of thing depends on your operating system.  As I understand your
> question, you want to simulate multiple TCP/IP clients arriving to a server
> from different IP addresses.
>
> If you are on a *nix-style machine using the BSD sockets API, the system
> call you want is "bind".  Normally you don't bind() a client socket, since
> you want the OS to figure it out for you.  But if you want to tell the OS
> precisely which IP address to use, the bind call can associate the socket
> with the address.
>
> Best,
> Michael
> --
> Michael Hanson - Principal Engineer, XML Engineering
> [email protected]
>
> On Jul 28, 2009, at 9:37 AM, Brian Kim wrote:
>
>> Hi. all.
>>
>> There is a sample program for parsing html from entered URL. I
>> remember it is xmllint.c
>>
>> By the way, as my testing program, I want to simulate "multiple IPs"
>> visits other websites at the same time.
>>
>> By "multiple IPs" I mean, I am going to use a machine which has IP
>> aliasing set up and my test program that I
>>
>> need to create will go to a differenct URL with aliased IP. As a
>> result, a program simulates multiple machines
>>
>> access to different URLs at the same time, even though the program
>> runs in a machine.
>>
>> Is there anybody who knows if I can implement it and how?
>>
>> Thanks.
>> _______________________________________________
>> xml mailing list, project page  http://xmlsoft.org/
>> [email protected]
>> http://mail.gnome.org/mailman/listinfo/xml
>
>
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to