How to request from specific internet adapter in Python?How do I copy a file in Python?How can I safely create a nested directory in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?Python progression path - From apprentice to guruHow do I lowercase a string in Python?How to remove a key from a Python dictionary?

Western buddy movie with a supernatural twist where a woman turns into an eagle at the end

In a Spin are Both Wings Stalled?

I'm flying to France today and my passport expires in less than 2 months

Is Lorentz symmetry broken if SUSY is broken?

Is the Joker left-handed?

Today is the Center

Is "remove commented out code" correct English?

Why is the 'in' operator throwing an error with a string literal instead of logging false?

How to prevent "they're falling in love" trope

90's TV series where a boy goes to another dimension through portal near power lines

Is it inappropriate for a student to attend their mentor's dissertation defense?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Should I tell management that I intend to leave due to bad software development practices?

Stopping power of mountain vs road bike

Why does Kotter return in Welcome Back Kotter

What's the point of deactivating Num Lock on login screens?

Has there ever been an airliner design involving reducing generator load by installing solar panels?

Python: return float 1.0 as int 1 but float 1.5 as float 1.5

Neighboring nodes in the network

Is there a hemisphere-neutral way of specifying a season?

Took a trip to a parallel universe, need help deciphering

How can I make my BBEG immortal short of making them a Lich or Vampire?

How do I write bicross product symbols in latex?

Watching something be written to a file live with tail



How to request from specific internet adapter in Python?


How do I copy a file in Python?How can I safely create a nested directory in Python?How do I parse a string to a float or int in Python?How to get the current time in PythonHow can I make a time delay in Python?How do I get the number of elements in a list in Python?How do I concatenate two lists in Python?Python progression path - From apprentice to guruHow do I lowercase a string in Python?How to remove a key from a Python dictionary?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I need to have a script making request from ethernet 1 (Internet provider 1) and another script to use ethernet 2 (Internet provider 2).



All I've been able to get was changing the socket's local IP but don't know how to use another adapter.



This is my current code.



import socket

s = socket.socket()
s.bind(('192.168.1.6', 0))
s.connect(('www.google.com', 80))









share|improve this question
























  • Different NIC, route or IP?

    – Klaus D.
    Mar 7 at 22:38











  • NIC, I have 2 internet providers/2 modems.

    – Mauricio Herrera
    Mar 7 at 22:44











  • It's easy to define the source address but to which interface a packet goes is desided by your routing setup. In most cases it would be the interface with that IP but with special routings like two ISPs it might be different. And if the ISP lines are not directly connected to the computer the program runs on, it is getting even harder.

    – Klaus D.
    Mar 7 at 22:54


















1















I need to have a script making request from ethernet 1 (Internet provider 1) and another script to use ethernet 2 (Internet provider 2).



All I've been able to get was changing the socket's local IP but don't know how to use another adapter.



This is my current code.



import socket

s = socket.socket()
s.bind(('192.168.1.6', 0))
s.connect(('www.google.com', 80))









share|improve this question
























  • Different NIC, route or IP?

    – Klaus D.
    Mar 7 at 22:38











  • NIC, I have 2 internet providers/2 modems.

    – Mauricio Herrera
    Mar 7 at 22:44











  • It's easy to define the source address but to which interface a packet goes is desided by your routing setup. In most cases it would be the interface with that IP but with special routings like two ISPs it might be different. And if the ISP lines are not directly connected to the computer the program runs on, it is getting even harder.

    – Klaus D.
    Mar 7 at 22:54














1












1








1








I need to have a script making request from ethernet 1 (Internet provider 1) and another script to use ethernet 2 (Internet provider 2).



All I've been able to get was changing the socket's local IP but don't know how to use another adapter.



This is my current code.



import socket

s = socket.socket()
s.bind(('192.168.1.6', 0))
s.connect(('www.google.com', 80))









share|improve this question
















I need to have a script making request from ethernet 1 (Internet provider 1) and another script to use ethernet 2 (Internet provider 2).



All I've been able to get was changing the socket's local IP but don't know how to use another adapter.



This is my current code.



import socket

s = socket.socket()
s.bind(('192.168.1.6', 0))
s.connect(('www.google.com', 80))






python sockets python-requests ip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 0:05









Heikki

1,4891018




1,4891018










asked Mar 7 at 22:28









Mauricio HerreraMauricio Herrera

62




62












  • Different NIC, route or IP?

    – Klaus D.
    Mar 7 at 22:38











  • NIC, I have 2 internet providers/2 modems.

    – Mauricio Herrera
    Mar 7 at 22:44











  • It's easy to define the source address but to which interface a packet goes is desided by your routing setup. In most cases it would be the interface with that IP but with special routings like two ISPs it might be different. And if the ISP lines are not directly connected to the computer the program runs on, it is getting even harder.

    – Klaus D.
    Mar 7 at 22:54


















  • Different NIC, route or IP?

    – Klaus D.
    Mar 7 at 22:38











  • NIC, I have 2 internet providers/2 modems.

    – Mauricio Herrera
    Mar 7 at 22:44











  • It's easy to define the source address but to which interface a packet goes is desided by your routing setup. In most cases it would be the interface with that IP but with special routings like two ISPs it might be different. And if the ISP lines are not directly connected to the computer the program runs on, it is getting even harder.

    – Klaus D.
    Mar 7 at 22:54

















Different NIC, route or IP?

– Klaus D.
Mar 7 at 22:38





Different NIC, route or IP?

– Klaus D.
Mar 7 at 22:38













NIC, I have 2 internet providers/2 modems.

– Mauricio Herrera
Mar 7 at 22:44





NIC, I have 2 internet providers/2 modems.

– Mauricio Herrera
Mar 7 at 22:44













It's easy to define the source address but to which interface a packet goes is desided by your routing setup. In most cases it would be the interface with that IP but with special routings like two ISPs it might be different. And if the ISP lines are not directly connected to the computer the program runs on, it is getting even harder.

– Klaus D.
Mar 7 at 22:54






It's easy to define the source address but to which interface a packet goes is desided by your routing setup. In most cases it would be the interface with that IP but with special routings like two ISPs it might be different. And if the ISP lines are not directly connected to the computer the program runs on, it is getting even harder.

– Klaus D.
Mar 7 at 22:54













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053825%2fhow-to-request-from-specific-internet-adapter-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55053825%2fhow-to-request-from-specific-internet-adapter-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

1928 у кіно

Захаров Федір Захарович

Ель Греко