Python socket problem

Joined
Sep 19, 2006
Messages
2
Reaction score
0
Hi,

i have been writing a simple currency converter in vb.net lately, a converter that allows the user to update the convertion rate fom the internet.
So, in the vb.net program i have written a simple tcp client that connects well to, for example, an irc for example and is able to retrieve data from it.

Now here comes the trouble. I have written a simple server in Python, so to deliver the conversion rate to the client when it connects to it.

Here's code for the server part :
Code:
#!/usr/bin/env
# -*- coding: windows-1251 -*-
# Socket training
# the server part

import socket

host=''
port=2367

my_socket=socket.socket(socket.AF_INET,socket.SOCK_STREAM)

try:
    my_socket.bind ((host,port))
    print 'bind succeeded!';
except:
    print 'bind failed!'
    sys.exit()

#print 'server is listening on port',port

while True:
    my_socket.listen(1) 
    client_sock,client_adress=my_socket.accept()
    print 'Çàðàç íà çâÿçêó ç ',client_adress
    
    try:
        recvd_msg=client_sock.recv(1000)
        print 'recvd_msg=',recvd_msg
    except:  
        print 'could no receive from ',client_sock                  
    client_sock.close()

I have a LAN at home, and the vb.net program is launched from 192.168.0.1 and the python server is hosted on 192.168.0.2(this is a FreeBSD machine) wich i have set up in the DMZ zone.

When i run the server, i get 'bind succeeded!' and then i try and launch the updating feature from my vb.net program and after a few seconds i get an error saying that it could not connect to server because server expressly denied it...

The machine on wich is my vb.net program running is a firewall, but i turned it off completely, and on the FreeBSD machine, there ain't no firewall or security features i could think of though...

Thanks for your help,
mcp
 

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

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top