Click to See Complete Forum and Search --> : socket qustion


skyantao
June 1st, 2004, 06:48 AM
My pc have two adpters.One IP is 172.20.0.1 mask is 255.255.0.0
the other IP is 200.200.200.139,mask is 255.255.255.0.Now I will use 172.20.0.1 to trans files to the other pc Named A(this pc have two adpters to map my pc),the other adpter to send command to A.FOR example,I will copy file to A,I copy file to \\172.20.0.2\Clip ,the 172.20.0.1 used.But my app want use 200.200.200.139 to send udp broadcast (just only use 200.200.200.139).In fact ,when i bind the IP 200.200.200.139 to socket ,172.20.0.1 send datas to.how can i only use 200.200.200.139 to send data ,please help me.

win2kp sp4 vc6 sp6
my code!
m_addr.sin_family = AF_INET;
m_addr.sin_addr.s_addr = inet_addr("200.200.200.139");
m_addr.sin_port = m_nPort;

int ret = 0;
int error = 0;

if (bind(m_hSocket, (struct sockaddr FAR *)&m_addr, sizeof(m_addr)) == SOCKET_ERROR)
{
DWORD error=::GetLastError();
closesocket(m_hSocket);
return FALSE;
}

Thanks!

kuphryn
June 1st, 2004, 12:12 PM
Okay. Lets hammer through this problem.

You have one workstation with two NIC. Correct?

You want to use one NIC as a server. Correct?

I saw that you mentioned UDP. Where in your code is the UDP binding? The code you've posted does not specify the protocol.

Kuphryn