These two tools might be of interest to you.
From the Wireshark Tools Wiki:
Nemesis is a command-line network
packet crafting and injection utility.
Nemesis can natively craft and inject
ARP, DNS, ETHERNET, ICMP, IGMP, IP,
OSPF, RIP, TCP and UDP packets. (GPL,
BSD/Linux/Solaris/Mac OSX/Win32)
You might also want to check out Winsock Packet Editor:
WPE Pro 0.9a (Windows XP, 2003, Vista,
7), 1.3 (Windows 95, 98, ME, 2000)
Winsock Packet Editor (WPE) Pro is a
packet sniffing/editing tool which is
generally used to hack multiplayer
games. WPE Pro allows modification of
data at TCP level. Using WPE Pro one
can select a running process from the
memory and modify the data sent by it
before it reaches the destination. It
can record packets from specific
processes, then analyze the
information. You can setup filters to
modify the packets or even send them
when you want in different intervals.
WPE Pro could also be a useful tool
for testing thick client applications
or web applications which use applets
to establish socket connections on non
http ports.