2

I am looking for the simplest/easiest way to implement some sort of networking communication using edk2 in a UEFI application. I do not care what type of protocol is being used, but it shall not be UDP.

I have read similar questions, tried a bit on my own but failed, and my problems are; -A good test environment(Using a VM currently, running UEFI 2.5, not sure if sufficient/is a good way) -What protocols/solutions are good?

What I need to accomplish is;

  1. uefi application loads, sends a packet containing "Hello" to Server(IP can be known, no need to resolve IP from url)
  2. Server sends "Hello" to the Client, and the UEFI application will print the reply. It is very simple, but this has been overwhelming and the information out there is limited from what I have seen.

All help/insight/information is appriciated.

1 Answers1

0

There is a complete HTTP sample program in the UEFI specification (Chapter 29.6.2.1). There is also a complete UDP sample on stackoverflow, if you want to use TCP you just need to connect to the server before sending data. The method and field names are nearly the same in the TCP and UDP protocols.

All higher level network protocols work in the same way.

  1. Create a child instance, search for the ServiceBinding protocol and call CreateChild
  2. Get the protocol from the child instances handle
  3. Configure the child instance (XYZ->Configure(...))
  4. TCP only: Create a Connect Token
  5. TCP only: Call XYZ->Connect(...) and wait till it completes
  6. Create a Transmit/Request Token
  7. Call XYZ->Transmit(...)/XYZ->Request(...) and wait till it completes
  8. Create a Receive/Response Token
  9. Call XYZ->Receive(...)/XYZ->Response(...) and wait till it completes
  10. Go back to 6 or 8 if you need to transmit/receive more data
  11. TCP only: Create a Close token
  12. TCP only: Call XYZ->Close(...) and wait till it completes
  13. Destroy the child instance (ServiceBinding->DestroyChild(...))

You may call XYZ->Poll(...) while you are waiting for the network operations to complete.

MiSimon
  • 1,225
  • 1
  • 8
  • 10