473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

sending Msg after AddIPAddress

Hi there,

My machine have 2 Network Adapters (NIC). I try to assign different IP
to 1 adapter using IPHelper's AddIPaddress API. Then I used Socket to
bind that IP and send to another machine IP address.
I was unable to send sucessfully. I can send only another NIC IP in my
machine. How do i set socketoptions or gateway setting whenever after i
add new ip address?

Here is code example

// returnCode = AddIPAddress(staticIP, staticMask, adapterIndex, ref
nteContext, ref nteInstance);

Socket s = new
Socket(AddressFamily.InterNetwork,SocketType.Strea m,ProtocolType.Tcp);
byte[] msgBytes = System.Text.Encoding.ASCII.GetBytes("Hello Server");

// new IPaddress I assign - 10.23.25.101
IPEndPoint localEP = new
IPEndPoint(Dns.Resolve("15.23.25.41").AddressList[0],0);
IPEndPoint remoteEP = new
IPEndPoint(Dns.Resolve("192.168.2.220").AddressLis t[0],9000);
s.Bind(localEP);
s.Connect(remoteEP);
s.Send(msgBytes);
s.Shutdown(SocketShutdown.Both);
s.Close();

Any idea would be appreciated. thanks in advance

Mar 4 '06 #1
0 1102

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: coder_1024 | last post by:
I'm trying to send a packet of binary data to a UDP server. If I send a text string, it works fine. If I attempt to send binary data, it sends a UDP packet with 0 bytes of data (just the...
0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
1
by: Jazper Manto | last post by:
hi i'm using the APIs AddIPAddress and DeleteIPAddress from the Iphlpapi.lib in the Microsoft Platform SDK. On MSDN i found the compatibility of them: Windows NT: Requires version 5.0 or...
0
by: Ignacio | last post by:
Hi: I try to use the addipaddress in vb.net, the api function parameters are: DWORD AddIPAddress( IPAddr Address, IPMask IpMask, DWORD IfIndex, PULONG NTEContext, PULONG NTEInstance
3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
0
by: remya1000 | last post by:
by using FTP i can send files to server using vb.net. if the file is big, then it will take some time to complete the sending process to server.or if we were sending 3-4 files to the server one by...
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.