Socket problem

L

Luca Di Cerneglons

Hi!
I use a socket to communicate with a print server from my ppc:

Dim skt As New
Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp)

Dim EP As New IPEndPoint(IPAddress.Parse("192.168.0.101"), 9100)
skt.Connect(EP)

It works well, but using the same syntax (changing IP and port!) to
communicate with a TcpListener on my PC I recieve an error:
"the machine actively refused it"

I tried also with a TcpClient, cutting and pasting the MSDN example,
but the error is the same...

I turned off any firewall on my PC but the error is still there!

Any idea?

Thanks in advice!
 
P

Paul G. Tobey [eMVP]

Actively refused indicates that no one was listening on the other end (or,
as you noted, that the firewall blocked it). There's either a port number
error, an IP address error (in the program on the PC end), or something of
that sort.

Paul T.
 
L

Luca Di Cerneglons

Thanks for the answer, Paul!

The netstat command on my PC indicates that there is a socket listening
on the right port, it seems ok but doesnt work, so I tried another
way..

I downloaded the sample application "Signature Capture" and adapting
it's code to my application, finally, I'm able to use sockets, but
there are still problem: losing the connection the PPC can't restart
the socket properly and I must HARD reset the device (the soft reset is
not enough!).

OK, i will work around this problem but...what a stress!

Bye
 
P

Paul G. Tobey [eMVP]

That's not generally a problem. You still have a bug in your code or
there's something that you're not telling us about how things are
implemented. How is the network connection made (Ethernet, wireless
Ethernet, GPRS, ActiveSync)?

Paul T.
 
L

Luca Di Cerneglons

Paul G. Tobey [eMVP] ha scritto:
That's not generally a problem. You still have a bug in your code or
there's something that you're not telling us about how things are
implemented. How is the network connection made (Ethernet, wireless
Ethernet, GPRS, ActiveSync)?

The first you said...a bug somewhere!
Using a wireless connection I'm trying to send data from the PC to the
PPC to update a SQL CE database.
First I tried with the Push-Pull methods, but I need more performance
'cause data to move are not so much and the changes comes from the PC
(I can't do a Pull from the PPC every minute, it takes too much time!).

But maybe there is another way, that I don't know, to simply send
something tho the PPC rather than use a TcpListener in loop on my
device.
Something like a trigger in the MSDE database that notifyes changes to
the PPC, I'm still looking..

Thanks a lot.

Bye, Luca.
 
P

Paul G. Tobey [eMVP]

No, implementing a socket is going to be the fastest, in a transport sense,
at least.

So, the desktop PC has a socket open and waiting for a connection from the
PPC, right? The PPC, in your test, connects successfully to the desktop
device or not? If not, you're saying that the error is that the connection
was actively refused? If that's the case, I'm am absolutely *sure*, 100%
that you either have not disabled the firewall, are not connecting from the
PPC to the correct port on the desktop PC, or the desktop PC is *not*
listening on the port you're connecting to. That's just the way it is. You
have a bug.

If you keep changing what you are doing, I can't help you. Your
descriptions are not sufficiently detailed to follow and, because your
English is not perfect and my Italian is non-existent, we have a problem.
If you are still getting this actively-refused error, send *both* sides of
the communication program, simplified to the point where all that happens is
the desktop PC waits for a connection and displays any data that comes in
and the PPC tries to connect and, if successful, just sends a couple of
strings, then disconnects. I'm 100% sure that, if this fails in your
configuration, you have a configuration problem, but I'll test it here and
prove it for you.

If you do this, ZIP each program and attach them to your message...

Paul T.

Luca Di Cerneglons said:
Paul G. Tobey [eMVP] ha scritto:
That's not generally a problem. You still have a bug in your code or
there's something that you're not telling us about how things are
implemented. How is the network connection made (Ethernet, wireless
Ethernet, GPRS, ActiveSync)?

The first you said...a bug somewhere!
Using a wireless connection I'm trying to send data from the PC to the
PPC to update a SQL CE database.
First I tried with the Push-Pull methods, but I need more performance
'cause data to move are not so much and the changes comes from the PC
(I can't do a Pull from the PPC every minute, it takes too much time!).

But maybe there is another way, that I don't know, to simply send
something tho the PPC rather than use a TcpListener in loop on my
device.
Something like a trigger in the MSDE database that notifyes changes to
the PPC, I'm still looking..

Thanks a lot.

Bye, Luca.
 

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