0

I need to write a program, which uses both protocols -TCP and UDP (my project in university). Question: is it possible (in theory) to use both protocols in the one application? Because I already tried to do this(vb 6.0), and the i get error - "invalid operation at current state"

Private Sub Form_Load()
With UDPSOCK
.RemoteHost = "192.168.1.203"
.RemotePort = 5510
.Bind 5510
End With
With TCPSOCK
.Protocol = sckTCPProtocol
.RemoteHost = "192.168.1.203"
.RemotePort = 5510
.Bind 5511
End With
End Sub

Private Sub TCP_Mode()
TCPSOCK.Connect ' ERROR HERE
TCPSOCK.SendData "Retransmission"
End Sub

This is a little part of my code. UDP protocol work perfect (send and receive). But when i try to call TCP_Mode() i get an error "invalid operation at current state". Thanks very much to all.

skryvets
  • 2,808
  • 29
  • 31
  • Yes! tcp and udp both can work at the same time, I have done it using lwip tcp ip stack, and it will also work on freebsd sockets in linux. No Idea about your error though!! – Ishmeet May 20 '14 at 09:21
  • Some help related to your question --> http://stackoverflow.com/questions/6437383/can-tcp-and-udp-sockets-use-the-same-port – Ishmeet May 20 '14 at 09:24
  • the error probably comes from TCPSOCK being connected already. Make sure to close its connection first before making a new connection. – Hrqls May 20 '14 at 11:21

0 Answers0