socket programming

G

Guest

Hi All,

I am doing socket programming.

Client is in C#.Net 2003 and Server is in VC++ 6.0

When Server uses csoc class than it connect & communicate to client without
any problem....

while it uses api on server side so it is not able to connect it throws an
error no 10061...

System.Net.Sockets.SocketException: No connection could be made because the
targ
et machine actively refused it
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)

pls help me its urgent

if any socket api in c#.net then pls give me link or details abt that

Thanx & Regards....

--
Ather Murtuzapurwala
Software Engineer
Mumbai,India

A man of trial is a man of success
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

My guess is that you are using an incorrect combination of port/ip

In .NET you use the System.Net.Sockets or System.Net classes for sockets
comm.
My advice is that you use TcpClient instead of Socket for simple
communications.

Cheers,
 
N

Nicholas Paldino [.NET/C# MVP]

Also, I would say, did you look at the ErrorCode property on the
exception that was thrown? It will return the value from the last API call
when an exception was thrown, and you should see more detailed error
information from that.

Hope this helps.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

I forgot to mention, try a telnet to the ip & port from a command prompt
and see if you can connect, if you get a complete blank screen you are
connected.

cheers,
 
G

Guest

Dummy question on this topic.

When you are establishing connections, to a server it opens a connection and
you can see it in netstat. What if you open another connection from the same
source computer to the same destination computer. Will it see that it
already has one and just use it? Or is there a way to force it to keep
opening new ones. We are building a test tool to throw load at it, and we
appear to be only using 2 connecitons and can not throw enough load at it
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi Chris,


Chris said:
Dummy question on this topic.

When you are establishing connections, to a server it opens a connection
and
you can see it in netstat. What if you open another connection from the
same
source computer to the same destination computer.

A new connection will be established ( if the server does support it ) ,
See a connection with 4 components , Source IP, Source Port, target IP,
target port. that combination has to be unique.
What happen is that you do not especify the source port and a different
port is used each time you open a new connection.

What needs to be unique is the process listening in a particular port in
the server side. normally a process that is blocked waiting a connection,
once it gets it i create another thread to service this connection and goes
back to block until the next connection request arrive.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top