CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Question Connect window xp to linux(udp socket programming)

    Hi.

    I'm new to vb6.

    I want to transmit data between linux(C laguage) and window xp(vb6) with UDP socket.

    I already used "winsock" in vb6, but data wasn't transmitted with linux server.

    Do I need to make structure(sockaddr_in) in vb6 so that linux server can read it?

    Or can I use this structure type without any declare in vb6?

    Here's my VB6 code,
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

    Code:
    ''''send data'''''''''''''''''''''''''''

    Private Sub cmdSend_Click()
    wsClient.SendData txtSend.Text
    DisplayText "<Client> " & txtSend.Text
    txtSend.Text = vbNullString
    End Sub
    .................
    ''''receive data'''''''''''''''''''''

    Private Sub wsClient_DataArrival(ByVal bytesTotal As Long)
    Dim strData As String
    wsClient.GetData strData, vbString
    DisplayText "<Server> " & strData
    End Sub
    ........
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    In order to receive/send data from/to this client(window, vb6),

    how does Linux sever(C program) can do?

    or

    Does window client need to be change? How?

    Please, it's urgent problem related with my research.

    thanks.

  2. #2
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Connect window xp to linux(udp socket programming)

    Sockets are Sockets. I have sent and received data from Linux servers before. There is no special programming that needs to be done. However, MOST linux servers are locked down now. That means you may not be able to listen for a connection on the linux server unless you allow incoming connections. Try using telnet to connect to the linux server from your PC. If that works, the winsock control should also work.

  3. #3
    Join Date
    Mar 2009
    Posts
    2

    Re: Connect window xp to linux(udp socket programming)

    I check the connection with telnet but it is not connected.

    Do you know how can I connect it?

    Do I have to open the port(telnet port : 23)?

    In that case, I use another port in my program then I should open that port either?

    thanks.

  4. #4
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Connect window xp to linux(udp socket programming)

    You say you have a linux c program on the server/ What port is it listening on? Say it is on port 1054 then you try.

    telnet 192.168.0.2 1054

    telnet will then try to connect on that port. Since you are using UDP, you might get disconnected quickly. If you were using TCP, the connection would stay. I am not exactly sure how telnet will work with UDP.

    Maybe you should find a port scanner and see if the port is open on the linux computer. When you are doing network programming, you need to start with taking all of the security issues into account before you can proceed. For example, do you have a firewall on the Windows PC that could be blocking the connection. Is tere a firewall on the Linux Server that could be blocking the connection. Is there a router in-between the computers that could be blocking the connection (a lot of home network routers will block ports). Once you are sure you actually can connect to the Linux server, then start on the programming.

    Hope this helps.

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Connect window xp to linux(udp socket programming)

    Pretty sure that you can't TELNET to anything with UDP packets, but I could be wrong
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured