# PF firewall setting for network programming



## Vitamin (Apr 13, 2012)

Network programming newb.....just playing around with some code I found online.

The port that the program is listening on is 3490, in the PF firewall manager, what service should be selected with port 3490 to ensure proper communication during a telnet session? Should I set up telnet for outgoing and incoming via port 3490?

Below is the pic of my firewall manager







I'm using emacs, if that helps


----------



## SirDice (Apr 13, 2012)

OS-X related questions should be asked on an OS-X forum.


----------



## Vitamin (Apr 13, 2012)

I'm not using OS-X


----------



## DutchDaemon (Apr 13, 2012)

The service name comes from /etc/services. Port 3490 is not bound to a service name. So either put a name in there and use that, or keep using 'Unknown'. Note that the large majority of people here use /etc/pf.conf, where you don't need to define a name like that, though you can (e.g. 'port 22' and 'port ssh' are equivalent)..


----------



## Vitamin (Apr 13, 2012)

*T*hanks for the reply.

The "Unknown" service entry in the picture I attached. It changes from telnet to unknown after a while. What would happen is, telnet session will connect, but I cannot communicate during session. I don't see the customized welcome message for each new accepted connection that is in the program. I type in the telnet window, but the program doesn't receive the message.

If I do [cmd=]netstat -a[/cmd] I see the Recv-Q with bytes of pending data, but Send-Q is empty. I executed different programming projects, from different websites, but same results. So I assume that my firewall settings are to blame.


----------



## DutchDaemon (Apr 14, 2012)

Assuming you're running the program yourself and want to allow traffic from the outside in (and assuming it runs on the pf machine), a pf rule would look like this. Can't help you with any firewall managers, I don't use any.


```
pass in quick on em0 inet proto tcp from any to em0 port 3490 keep state flags S/SA
```


----------



## Vitamin (Apr 14, 2012)

*T*hanks, added it, but still have the problem of having a successful telnet session connection, but not being able to send or receive messages. I will go to the development section for programming specific questions.


----------

