Can you be more specific? What os? What do you want to relay? TCP or UDP? Is your server program crashing? why do you restart the server?
I can give you a vague answer for a vague question: when you want to proxy tcp connections, then you could have a udp socket, which never sends data but listens for some kind of magic paket or port knocking combination, then enable the sender ip address in your firewall.
Sorry it's been a bit we had a baby girl so its taken up my time.
I can post some code later today
So I used the idea of a chat server to start making a telnet Honeypot. But if I scan it with nmap it crashes the server and I'm not really sure why.